balor
Programmer
- Jul 24, 2000
- 74
How do I use a variable in the FOR expression for a cursor.
I want to do something like this:
SET @sSQL = 'SELECT *
FROM ' + @sLinkedDBName + '...Table1'
DECLARE TheCursor CURSOR
FOR @sSQL
OPEN TheCursor
.
.
.
How do I use the "@sLinkedDBName" - variable in the FOR expression? It does not like when i first set it in a variable and then use that variable in the expression.
//Balor
I want to do something like this:
SET @sSQL = 'SELECT *
FROM ' + @sLinkedDBName + '...Table1'
DECLARE TheCursor CURSOR
FOR @sSQL
OPEN TheCursor
.
.
.
How do I use the "@sLinkedDBName" - variable in the FOR expression? It does not like when i first set it in a variable and then use that variable in the expression.
//Balor