roaddog Posted February 7, 2015 Share Posted February 7, 2015 (edited) I have found this ALTER TABLE function lately, so I want to know how to check whether the column exists by using some kind of IF NOT EXISTS statement? Any idea how to do so? Edited February 8, 2015 by Guest Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 IF COL_LENGTH('table_name', 'column_name') IS NULL BEGIN ALTER TABLE table_name ADD [column_name] INT END Example taken from: http://stackoverflow.com/questions/8870 ... eady-exist Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now