March 25, 2004 at 5:40 pm
I have a need to alter a table with a SQL script, which may have been previously modified. The concern is to first check to see if a field has been previously been added to a table.
Due to some loosely controlled versioning issues, the end user may have all ready added the new table
What I need is the syntax to check if the field "IncludeQuestion" in the table "T_Customize" exists, an if not create the field.
I can handle the alter table script as well as creating indexes and such. My only concern is to test to see if I need to run the alter script.
Any help would be greatly appreciated!
John
March 25, 2004 at 6:01 pm
If exists(select * from information_schema.column where table_name='T_Customize' and column_name='IncludeQuestion')
alter statement
March 25, 2004 at 7:33 pm
Thanks ever so much!
You've made my day.
John
April 2, 2004 at 10:01 am
Hi,
What is the "information_schema" in "information_schema.column". Can someone provide an example.
Thanks
April 2, 2004 at 12:36 pm
It's a VIEW.
Refer to the Books OnLine (BOL), use the Index tab and enter INFORMATION_SCHEMA. You'll see a whole list of these views.
-SQLBill
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply