sql server - Checking for Constraint -


i need write sql script ensure constraint existing.

if constraint exists, dropping constraint. how achieve this?

if object_id('schema.constraintname') not null    alter table schema.foo drop constarintname 

you need schema.constraintname correctly resolve schema. have 2 pk_foo objects if have tables this.foo , that.foo


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -