0

I been using SSMS for diagramming my databases and I got used to create the key constraints with this tool. Now I started thinking, while going through related chapter of a book, "...maybe this is not such a good practice"

Is there any downside towards this practice? That is defining key constraints using the Diagram Designer on SSMS?

2
  • 1
    So you do design them like this on your Development server, then have to redo that action in Test and again in Production environments? It's probably quicker to write out the SQL script than use the designer Apr 17, 2015 at 14:32
  • Yeah, on my development environment I scheme the database, create the tables, diagram and finally create key constraints using my Diagram. Finally I upload to test server and once tested alongside with the frontend it goes into production. Yeah, that's pretty much all the process... No problems so far, but Its good to have an external input specially if it bests productivity.
    – Nelson
    Apr 17, 2015 at 14:42

1 Answer 1

2

I would suggest NOT to use Designer in creating key constraints or doing any DDL / DML operations.

Best is to use T-SQL - much flexible, more options, more powerful and you can automate many things with it. There is a learning curve, but its worth learning TSQL rather than keep using GUI.

Also, make sure you are using the latest version of SSMS - sql server 2014. Download it from here.

Read up : Managing SQL Server via Management Studio vs TSQL Commands

e.g. From BOL

ALTER TABLE dbo.DocExc 
   ADD ColumnD int NULL 
   CONSTRAINT CHK_ColumnD_DocExc -----> This is your constraint
   CHECK (ColumnD > 10 AND ColumnD < 50);
GO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.