Geeks With Blogs

Michael Freidgeim's Blog MS .Net Development August 2011 Entries
DDL 'IF not Exists" conditions to make SQL scripts re-runnable
As a part of continuous integration we are using deployment of database scripts, which makes very important to make the scripts re-runnable. Some checks for DDL elements are not obvious, and I decided to put hem in one place.Most answers were found on StackOverflow --Column does not exists if NOT Exists(select * from sys.columns where Name = N'CreatedDate' and Object_ID = Object_ID(N'MyTableName')) --Check if primary key does not exists IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CO... ......

Posted On Friday, August 12, 2011 7:20 AM

Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net | Join free