Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Cursors!!!

Author  Topic 

ruchirj07
Starting Member

37 Posts

Posted - 2007-10-19 : 05:11:30
In cursors how we can pass the multiple integer values.
e.g. i'm getting values 1,2,3,4 in stored procedure as varchar
i want to pass @Prior = (1,2,3,4) in the cursor
select colname from tablename with (nolock) where colname in (@Prior)
where colname is of type integer.

I have tried convert function for this but it failed saying cannot convert ',' to type integer. So for the meantime i have segregated the priorities to make my proc runnable.

Is there any solution for the same?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-19 : 05:24:37
If you have column names starting with numbers, you need to embrace them with brackets like this
[1], [2], [3]

BUT! Using IN means you are selecting on a value for a specific column for all records, not columns themself.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -