This blog is about my history as a software engineer utilizing technologies C#, Java, React, JavaScript, .NET Core, SQL Server , Oracle, GIT, GitHub, Jira, Azure, AWS and HTML5. “I have not failed. I've just found 10,000 ways that won't work.” Thomas A. Edison. Please click on all my ADVERTISING links to help support this blog. Thank you.
Tuesday, March 12, 2013
T-SQL Library - Check if Column Exists Alter Table
Composing T-SQL to run over and over to check into source control for column change....
IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'tbl_Provider_Concerns'
AND COLUMN_NAME = 'concern_status_id')
BEGIN
ALTER TABLE tbl_Provider_Concerns
ADD concern_status_id INT
END
ALTER TABLE tbl_Provider_Concerns
ADD CONSTRAINT FK_Status
FOREIGN KEY(concern_status_id)
REFERENCES tbl_Provider_Concern_Status(concern_status_id)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment