Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Permission to TRUNCATE TABLE
Message
General information
Forum:
Microsoft SQL Server
Category:
Security
Miscellaneous
Thread ID:
00857388
Message ID:
00857887
Views:
24
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform