How to create dynamic cursor

  • Hi,

     I am facing a problem.The problem is that I want to create a cursor but for that I don't know the table name and fields name.Everything will generate dynamically.So can any one tell me how to do that? Is it really possible?

    Regards

    Niladri

     


    Thanks & Regards,

    Niladri Kumar Saha

  • Do it with Stored Procedure.... pass the table name and feild name as arguments.... I dont know what u really want and doesn't know when will u have tablename & feildname with u to create the cursor....

     

  • A virtual friend of mine, SQL Server MVP Erland Sommarskog, has dedicated a separate chapter on the use of dynamic SQL and cursors here http://www.sommarskog.se/dynamic_sql.html

    See if that is what you want or if you can avoid at least one of these two.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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