Saturday, 16 June 2018

MSSQL - Sql server - insert into table if record doesn't exist

Watch on YouTube


Select * From Orders

If not exists (Select * From Orders where OrderID = 10)
Begin
    Insert Into Orders (OrderID, ProductID, Qty, test) Values(10, 1, 20,1)
End

Select * From Orders

No comments:

Post a Comment