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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-07-15 : 10:24:36
|
| Wilfred writes "Is it possible to write dynamic cursor in Ms-sql if not how can i achieve thisdeclare @tb varchar(90)select @tb='mydb.syscolumns'declare tbfrom insensitive cursor for select 'Column_name 1' = name, 'Type' = type_name(xusertype), 'Length' = length from @tb where id = @objtoid and number = 0 order by colid most appreciated" |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-07-15 : 12:04:25
|
You can shoot yourself in the head with a shotgun...but it ain't easyUSE NorthwindGODECLARE @sql varchar(8000), @OrderId intSELECT @sql = 'DECLARE myCursor99 CURSOR FOR SELECT OrderID FROM Orders'EXEC(@sql)Open myCursor99FETCH NEXT FROM myCursor99 INTO @OrderIdSELECT @OrderIdCLOSE myCursor99DEALLOCATE myCursor99 Brett8-) |
 |
|
|
drymchaser
Aged Yak Warrior
552 Posts |
Posted - 2004-07-15 : 12:09:40
|
| 8 to 5000 Brett. |
 |
|
|
|
|
|