General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Query Sql Server tables and run code?
Let say I have a database in Sql Server with about 20 tables in it, and that most of those tables have a field "qty".
How could I write query that says
" For each table in the database where the table has a column named 'qty'
Select table_name, Max(qty) as max_qty "
Basically, I need a cursor that shows the tablename and the Max(qty) from that table.
BTW it doesn't matter to me whether this is code I from FoxPro or in Sql Server Mgmt Studio.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only