0

I am using this script https://stackoverflow.com/a/9452317/449156 to generate statements to drop and re-create all my foreign key constraints so I can truncate specific database tables.

This works excellently, however I am wondering how I can incorporate this into a Stored Procedure. At the moment all that happens is that it generates the command's but doesn't "call or run" them?

Community
  • 1
  • 1
BlueChippy
  • 5,935
  • 16
  • 81
  • 131

1 Answers1

0

you must execute the statements

if a statement is stored in a var @ddlStatement

Exec sp_executesql @ddlStatement
Raphaël Althaus
  • 59,727
  • 6
  • 96
  • 122