Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

How do I drop all constraints from all tables?

Asked by Aalap Prabhakaran Apr 22, 2021 1.1K views 1 answer
Share

About this question

 I want to drop all default constraints, check constraints, unique constraints, primary keys, and foreign keys from all tables in a SQL Server database. I know how to get all the constraint names from sys. objects, but how do I populate the ALTER TABLE part?

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.