sql Cursor

  • 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.....

  • 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

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply