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.
| Author |
Topic |
|
Valentino999
Starting Member
2 Posts |
Posted - 2002-02-28 : 03:48:13
|
| Hi folks,I would like do Declare a cursor like this:Declare @mytest varchar(500)SET @mytest = 'test1, test2, test3'Declare test_cursor CURSOR LOCAL FOR SELECT * FROM test WHERE testit IN(@mytest)HOW CAN I DO THAT??????Thanks |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-02-28 : 03:57:17
|
| Why would you want to declare a cursor - they are never necessary and usually counter-productive.trySELECT * FROM test WHERE ',' + replace(@mytest,' ','') + ',' like '%,' + testit + ',%'or look at the faq on csv strings.==========================================Cursors are useful if you don't know sql.Beer is not cold and it isn't fizzy. |
 |
|
|
Valentino999
Starting Member
2 Posts |
Posted - 2002-02-28 : 04:04:12
|
| Hey Thanks very muchIt works correctly |
 |
|
|
|
|
|