Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameterized stored procedure question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00727639
Message ID:
00727698
Vues:
9
Hi,

just a start: you can use SQL Server's sp_executesql SP or the EXECUTE to execute dynamic SQL. To find out the PK you can use sp_primarykeys. See BOL or MSDN Library for more details.

Regards,
Armin

>Hi,
>
>I need a family of rules that practically beg for a generalized stored procedure with parameters, but I don't know how to do it.
>
>The database contains data for several schools and each school has data for several years. The rules are required to make sure, for example, that a student registered in one school and year is not accidentally placed in a course for a different school or year.
>
>Let's call one procedure (a function really) IsSameSchool with four parameters: Name of table1, Value of PK for table1, Name of table2 and Value of PK for table2. The function already knows the name of the field that contains the school's FK. Let the function figure out which is the PK of each table. I think this requires the equivalent of a macro, and I don't know whether T-SQL even allows that.
>
>A related function might be GetSchool(Name of table, value of PK), but I don't know how to write that one either.
>
>Any suggestions?
>
>TIA,
>
>Alex

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform