Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in _menu_load_objects() (line 579 of /www/webvol38/16/9svvwb3gxs5tmhv/benzzon.se/public_html/includes/menu.inc).

SQL: Conditional insert

1 post / 0 new
benzzon
benzzon's picture
SQL: Conditional insert
IF NOT EXISTS(SELECT * FROM dbo.tablename WHERE field1='value1')
 
BEGIN
 insert into tablename(field1,field2) values ('value1','value2')
END
 
GO