Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find if a value is in a table
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01521232
Message ID:
01521236
Views:
35
>>Hi
>>
>>I want to find if a value is already in a table in SQL2005 and if it is I will raise an error .
>>
>>If not I add a record.
>>
>>I'm not sure what syntax to use to find if the value is already in the table.
>>
>>In Fox I would have used a SEEK
>>
>>
>>Thanks
>>
>>
>>Nick
>
>if 0= (select count(*) from mytable where myfield='myvalue')
>insert into mytable (field1,field2,field...) values (value1,value2,value3...)
>else
>RAISEERROR


Thanks William
Previous
Reply
Map
View

Click here to load this message in the networking platform