Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declare a Cursor with dynamic from table name

Status
Not open for further replies.

jonbrown

MIS
Jul 17, 2001
12
GB
I need to delare a cursor within a stored procedure, but do not know the name of some of the tables to be used in the query until run time.

I can get the table names into variables and can build the SQL Select statement into a string as required, however I cannot find out how to declare the cursor to use this string.

Any help would be much appreciated

Thanks

Jon.
 
Hi,

You may introduce the cursor definition is sql dynamic string too.
or you may construct a temporary stored procedure to do the job.



Hope this helps, xcata.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top