sql - Varchar to Int Conversion Error In Cursor Example -


first time trying cursor getting error varchar data type only. error "conversion failed when converting varchar value 'sgs' data type int"

in table stationid int , station varchar.

i have written code show able print int, when try varchar unable print.

declare @vstationid int, @vstation varchar(50) declare mycursor cursor  select stationid, station tblstation stationid='2' open mycursor   fetch next mycursor @vstationid,@vstation print @vstationid+' '+convert(varchar,@vstation) close mycursor deallocate mycursor 

please tell me error in code?

try this

declare @vstationid int, @vstation varchar(50) declare mycursor cursor  select stationid, station tblstation stationid='2' open mycursor   fetch next mycursor @vstationid,@vstation print convert(varchar,@vstationid)+' '+@vstation close mycursor deallocate mycursor 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -