Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run query on tables containing a certain column
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01567580
Message ID:
01567590
Views:
20
>Hi Naomi, thanks for your time, once I have the table names in my cursor how do I then perform my deletes using this cursor? say my query returns 10 records how do I loop through them ? In Fox it would simply be a scan and a "Delete from (cursorrow.tablename) where ??? etc... How do I code this ? Hope this makes sense

You will need to use dynamic SQL, in other words, generate your SQL command and then execute it using

sp_executeSQL stored procedure.

Take a look at some samples in this blog and blogs referenced in it

How to get information about all databases without a loop
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform