Checking for Constraint

I need to write a SQL script to ensure that a constraint is existing.

If the constraint exists, I will be dropping the constraint. How to achieve this?

Answers


IF OBJECT_ID('Schema.constraintname') IS NOT NULL
   ALTER TABLE Schema.foo DROP constarintname

You need Schema.constraintname to correctly resolve schema. You could have 2 PK_foo objects if you have tables this.foo and that.foo


Need Your Help

How to install subprocess module for python?

python python-2.7 subprocess

pip is not able to find this module, as well as me on pypi website.

Is it ok to submit application with following issue?

iphone memory-management app-store submit instruments

I have developed application and all is well. As well, I also keep memory foot print very low.No leaks show during application run. I tested application more than two hour and there is no crashing

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.