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 |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2006-06-09 : 12:12:42
|
| I have the following alter command:Can you please tell me, i want to add an if condition on the top to check if the field exists then ignore otherwise run the alter command:*******************************ALTER TABLE premlist_montserratADD filetype nvarchar(50)GO*******************************Thank you very much for the info. |
|
|
sanjnep
Posting Yak Master
191 Posts |
Posted - 2006-06-09 : 12:29:48
|
| if not exists (select * from syscolumns where object_id('premlist_montserrat')= id and name = 'filetype')begin ALTER TABLE premlist_montserratADD filetype nvarchar(50)end elsebegin print 'column alredy::::::'end--some thing like this ............Sanjeev Shrestha12/17/1963 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-10 : 03:35:38
|
| orif col_length('TableName', 'ColumnName') is nullAlter table ...MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|