Hi,
I am after the correct syntax for using an outer cursor value in an inner cursor select statement.
My outside cursor looks something like:
declare outerloop cursor for
select fieldname from table1
declare @FNAME as varchar(50)
open outloop
fetch next from outerloop into @FNAME
My problem is I want to open the second cursor and use the @FNAME from the first cursor as the COLUMN value I now need. ie
select driverNM, @FNAME from table2
This is where I have come unstuck. I initally did this in ACCESS using recordsets (with the help of a good programmer) and we finally gave up as the only lead was EVAL, which just didn't work.
I have tried square brackets, single and double quotes and combinations of each, without any luck so far.
Cheers
Mark
I am after the correct syntax for using an outer cursor value in an inner cursor select statement.
My outside cursor looks something like:
declare outerloop cursor for
select fieldname from table1
declare @FNAME as varchar(50)
open outloop
fetch next from outerloop into @FNAME
My problem is I want to open the second cursor and use the @FNAME from the first cursor as the COLUMN value I now need. ie
select driverNM, @FNAME from table2
This is where I have come unstuck. I initally did this in ACCESS using recordsets (with the help of a good programmer) and we finally gave up as the only lead was EVAL, which just didn't work.
I have tried square brackets, single and double quotes and combinations of each, without any luck so far.
Cheers
Mark