August 12, 2010 at 3:20 pm
Hi,
I have SQL 2008 Express version and in one of the table there is a hex value data. If the data is converted to string it displays some type of description in string. For example, the hex code: -536805679 converted should read: Incorrect Function. I tried the scripts below, but it didn't work. Any idea?
CAST( HexVal AS nvarchar(127)) AS HexErrorCode,
cast(cast(HexVal as varbinary(max)) as nvarchar(max)) ,
CONVERT(VARCHAR(8), HexVal ),
Thanks in advance,
August 12, 2010 at 5:22 pm
Declare @cmds Nvarchar(MAX)
Declare @obfoo varbinary(MAX)
Set @cmds = '
PRINT ''This binary string will execute "SELECT * FROM SYS.OBJECTS":''
SELECT * FROM SYS.OBJECTS
'
Set @obfoo = CAST(@cmds as varbinary(MAX))
Select @obfoo
select '
declare @_ as varbinary(max)
set @_ =' + sys.fn_varbintohexstr(@obfoo) + '
exec (@_)'
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply