Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-09-01 : 05:31:21
|
| Hi,how to add a condition ALTER TABLE EmrLicenseInfo ADD LICENSE_GROUP VARCHAR(100) default nullALTER TABLE EmrLicenseInfo ADD PRODUCT_VERSION VARCHAR(200) default nullNote: Add a condition that if column is not there then add column |
|
|
matty
Posting Yak Master
161 Posts |
Posted - 2009-09-01 : 05:36:09
|
| IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='EmrLicenseInfo' and COLUMN_NAME = 'LICENSE_GROUP')ALTER TABLE EmrLicenseInfo ADD LICENSE_GROUP VARCHAR(100) default null |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-09-01 : 05:36:29
|
| if not exists (select * from sys.columns where name ='LICENSE_GROUP' and object_id= object_id('EmrLicenseInfo'))beginALTER TABLE EmrLicenseInfo ADD LICENSE_GROUP VARCHAR(100) default nullEndSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-09-01 : 05:36:53
|
| if not exists(select * from information_schema.columns where table_name = 'EmrLicenseInfo' and column_name = 'LICENSE_GROUP' )ALTER TABLE EmrLicenseInfo ADD LICENSE_GROUP VARCHAR(100) default null |
 |
|
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-09-01 : 05:44:57
|
| Thank you |
 |
|
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-09-01 : 06:34:06
|
| in oracle? |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-09-01 : 06:43:34
|
| this is ms sql server forumspost it in oracle related forums or www.dbforums.com |
 |
|
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-09-01 : 07:08:26
|
| can you help me out |
 |
|
|
|
|
|