Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Table from Input Parameter in Cursor Definition

Author  Topic 

GhantaBro
Posting Yak Master

215 Posts

Posted - 2009-12-14 : 14:15:18
Hey Guys,
In my Proc I am passing the tablename as the input parameter. This table will be used in Definition of the Cursor... How can I dynamically use this input parameter for Select in the Cursor Definition? Thanks for the help.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-14 : 14:20:44
Sounds like you've got a poorly designed system. The only way to do this is to use dynamic SQL, which is going to be quite difficult with a cursor.

Why do you need to cursor through a dynamic table?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

GhantaBro
Posting Yak Master

215 Posts

Posted - 2009-12-14 : 14:26:20
quote:
Originally posted by tkizer

Sounds like you've got a poorly designed system. The only way to do this is to use dynamic SQL, which is going to be quite difficult with a cursor.

Why do you need to cursor through a dynamic table?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."



I have few tables that has filenames and SSIS package names associated with those files... I wanted to load all those files by calling dtexec one by one... I can do it using other ways..wanted to check if there is easy way to use variable as the tablename in the cursor definition. Thanks for your response.
Go to Top of Page
   

- Advertisement -