Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Permission to TRUNCATE TABLE
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Sécurité
Divers
Thread ID:
00857388
Message ID:
00857887
Vues:
23
>I'm not sure I like the idea of letting them pass in any table name, though. I'd likely either create a specific TRUNC sp for each table I want the user to be able to truncate or write some code that only does the TRUNCATE if specific table names are passed in.

Good point. I'll take your advice here.


>To make the SP work, you need to do something like:

> ...

>T-SQL won't let you use a variable/parameter just anywhere within a statement. You can get around that using the EXEC[UTE] syntax and also the sp_executesql system proc. The T-SQL help file has explanations and examples of using both. In fact, one of the examples for EXEC shows how to do a parameterized DROP TABLE, very similar to what you are wanting to do here.

Thanks for the corrections and guidance. This actually works, so the issue was not with the foreign keys.
Del
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform