Read line 1 of SQL errorlog file un readable

Hi friend,

I want to get first line of sql errorlog, but result unreadable.
this script relevant that i used.

"
Q:line 1 of file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log\ERRORLOG"
A: %ff%fe2%000%001%005%00-%000%006%00-%001%009%00 %000%008%00:%000%008%00:%001%008%00.%001%008%00 %00S%00e%00r%00v%00e%00r%00 %00 %00 %00 %00 %00 %00M%00i%00c%00r%00o%00s%00o%00f%00t%00 %00S%00Q%00L%00 %00S%00e%00r%00v%00e%00r%00 %002%000%000%008%00 %00R%002%00 %00(%00R%00T%00M%00)%00 %00-%00 %001%000%00.%005%000%00.%001%006%000%000%00.%001%00 %00(%00I%00n%00t%00e%00l%00 %00X%008%006%00)%00 %00
T: 0.658 ms
"
however, it supposed to be like this
"
2015-06-19 08:08:18.18 Server Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86)
Apr 2 2010 15:53:02
Copyright © Microsoft Corporation
Express Edition with Advanced Services on Windows NT 6.1 (Build 7600: )
"
any suggestion?

thanks
Rully

There looks to be a formatting issue with how the log is written and how IEM is reading it. It probably has to do with the log being written in UTF versus Unicode or something to that affect where IEM is reading it one way when it should read it another. I don’t work with SQL logs very often so I’m not sure what their native state is or why IEM wouldn’t be able to read it.

1 Like

As @jmaple suggests, this is in fact due to the file being formatted in Unicode. For the time being, you can try something like the following to parse out the undesirable characters:

concatenation of substrings separated by “%fe” of concatenation of substrings separated by “%ff” of concatenation of substrings separated by “%00” of line 1 of file “C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log\ERRORLOG”

2 Likes