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 |
|
GavinD1977
Yak Posting Veteran
83 Posts |
Posted - 2007-06-04 : 11:48:35
|
| Hi all.Can anyone tell me how to search a column for a value........for example 'STANDARD' and if it doesnt exist, enter it?thanks all. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-04 : 11:50:49
|
| [code]IF not Exists(select * from Table where SomeCol = 'STANDARD')Insert into Table(SomeCol)values('STANDARD')GO[/code]or[code]Insert into Table(SomeCol)Select 'STANDARD' where not exists(select * from Table where SomeCol = 'STANDARD')[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
GavinD1977
Yak Posting Veteran
83 Posts |
Posted - 2007-06-04 : 11:54:22
|
| brilliant............thanks Harsh. |
 |
|
|
|
|
|