• danielfountain (5/8/2014)


    Hi all,

    I am using a cursor (i know - but this is actually something that is a procedural loop).

    So effectively i have a table of names of stored procedures. I now have a store proc that loops around these procs and runs each one in order.

    Now i am thinking i would like to be able to set the table it loops around in a variable at the start - is it possible to do this? So effectively use a tablename in a variable to use in the sql to define a cursor?

    Many thanks

    Dan

    Passing the table name in a variable means that you will have to do this with dynamic sql. No problems there and straight forward really. Complexities start to pop up though if the tables have different structure, column names, data types etc..

    😎