Results 1 to 2 of 2

Thread: Dynamic SQL Cursor Column Problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2003
    Location
    India
    Posts
    227

    Dynamic SQL Cursor Column Problem

    Here is an example of cursor.

    VB Code:
    1. declare @a varchar(100)
    2.  
    3. declare c1 cursor for select name from sysobjects where name like 'x%'  
    4.  
    5. open c1
    6. fetch next from c1 into @a
    7. while @@fetch_status =0
    8. begin
    9.     print @a
    10.     fetch next from c1 into @a
    11. end
    12.  
    13. close c1
    14. deallocate c1

    Here we know the cursor SQL string. In case if I try to convert it as an SP and how do I iterate through the columns of the query which are passed dynamically?

    Thanks,
    Jai
    See you,
    -Jai
    [Friends Never Say Good Bye]

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width