Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query Sql Server tables and run code?
Message
 
 
À
08/05/2013 15:59:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01573064
Message ID:
01573070
Vues:
48
>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.

You can generate the script dynamically using INFORMATION_SCHEAM.Columns view.

I have a blog post on www.lessthandot.com that shows samples of such scripts.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform