jeudi 21 juillet 2016

Converting couple of characters from nvarchar to int

declare @var1 nvarchar(100)
set @var1='C85,c84,c88'
set @var1=REPLACE(@var1,'C','')
select column24 from someTable where column23 in (@var1)

Hello guys and gurls, I am new around here and I need help with this. This query gives me nothing I know its beacouse var1 is nvarchar but i dont know how to make it work. Dont ask me why I used that REPLACE, I am testing something, in this particular query it looks stupid. So close your eyes on that one :) And yes, there are rows 84,85,88 in someTable at column23. I am doing this only thru mssql management studio.

Aucun commentaire:

Enregistrer un commentaire