How to decode nvarchar to text (SQL Server 2008 R2)?

SQL Server 2008 actually has a built-in hex-encoding and decoding feature! Sample (note the third parameter with value "1" when converting your string to VarBinary): DECLARE @ProblemString VarChar(4000) = '54657374' SELECT Convert(VarChar, Convert(VarBinary, '0x' + @ProblemString, 1)) Ref: http://blogs.msdn.com/b/sqltips/archive/2008/07/02/converting-from-hex-string-to-varbinary-and-vice-versa.aspx The advantage of this approach is that you don't need the "Exec" call, which you generally try to avoid, for fear of injection among other things. The disadvantage is that it only works in SQL Server 2008 and later.

You will need a decoding function I think, the simplest: declare @fld nvarchar(4000) = '696D616765206D61726B65643A5472' exec('SELECT CONVERT(varchar(max),0x' + @fld + ')') --------------- image marked:Tr.

Declare @fld nvarchar(4000) set @fld = '696D616765206D61726B65643A5472' exec('SELECT CONVERT(varchar(max),0x' + @fld + ')') I think this will be more precise – Pankaj Jun 7 at 10:20 True, although for what its worth declare @v type = value is supported in sql 2k8 – Alex K. Jun 7 at 10:33 Yes, I apologize for this. – Pankaj Jun 7 at 10:42.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions