insert into Attributes (Id, Disabled, AttributeValue)
values (@id, @disabled, @attr_value)
if not exists
(
select * from Attributes
where
Id = @id
)
- Not sure, if this is a valid query.
- I have seen people use where not exists. What is the difference and how to use where not exists? When I put where not exists, it is saying "Incorrect syntax near where."
I checked these question as well. But, it doesn't seem to have query to insert using if not exists. Only inserting a row if it's not already there and sql conditional insert if row doesn't already exist
- Am I missing something? Should I only use where not exists?