Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

sql Cursor Expand / Collapse
Author
Message
Posted Wednesday, September 19, 2007 8:34 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 20, 2007 4:53 AM
Points: 1, Visits: 1

Somthing what i want to do

Declare @var varchar(8000)

set @var='select col,col2 from sometable'

DECLARE scanprofile CURSOR FAST_FORWARD READ_ONLY FOR

@var

OPEN scanprofile

FETCH NEXT FROM scanprofile

-------

Is it possible to do.....

Post #400615
Posted Thursday, September 20, 2007 1:52 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, November 20, 2007 7:43 AM
Points: 19, Visits: 33

Hi!

You can't assing to @var two values (col and col2).

Try this:


DECLARE @col (-- insert data type)
DECLARE @col2 (--insert data type)

DECLARE scanprofile CURSOR READ_ONLY
FOR

select col,col2 from sometable

OPEN scanprofile

FETCH NEXT FROM scanprofile INTO @col, @col2

Post #400677
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse