CONVERT STRING TO ASCII

Sunil Soni
Posted by Sunil Soni under Sql Server category on | Points: 40 | Views : 3153
declare @x nvarchar(100), @i int, @k int,@v int
--load this variable
set @x = 'ABCDEFGHIJKLMNOPQRST' + char(160) + '01' -- note: 160 is an html non breaking space
print @x
print '----------------'
print '' + char(9) + 'int' + char(9) + 'hex'
set @i = 0
while @i < LEN(@x)
begin
set @i = @i +1
set @v = ascii(substring(@x,@i,1))
print substring(@x,@i,1) + char(9) + convert(varchar,@v) + char(9) + convert(varchar,CONVERT(varbinary,@v),2)
end

Comments or Responses

Posted by: T.saravanan on: 9/14/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
kindly post your code inside the code tag.

Login to post response