MSSQL TSQL - Insert where not exists
Posted on 2010-11-26
I've trint to write some SQL to insert into a MSSQL database via asp - I trying to prevent duplicate rows being inserted into the database - but the following example keeps failing for some reason?
Insert into ProdFeatures (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14) Values ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14') Where Not Exists (select * from ProdFeatures where f1 = '1' and f12 = '12')
Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near the keyword 'Where'.
As always, any help is greatly appreciated.