Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql upsert

update table1 
set name = 'val2', itemname = 'val3', itemcatName = 'val4', itemQty = 'val5'
where id = 'val1'
if @@ROWCOUNT = 0
insert into table1(id, name, itemname, itemcatName, itemQty)
values('val1', 'val2', 'val3', 'val4', 'val5')
Comment

PREVIOUS NEXT
Code Example
Sql :: postgres list all triggers 
Sql :: how to find lowest in sql 
Sql :: mariadb add foreign key 
Sql :: how to find database collation in postgres 
Sql :: drop row pgadmin 
Sql :: sql compare two tables for differences 
Sql :: sql_calc_found_rows 
Sql :: create a view in sqlite 
Sql :: rename column sql 
Sql :: to date oracle 
Sql :: get all columns from table sql 
Sql :: t-sql delete view if exists 
Sql :: Mysql Create table with foreign keys. 
Sql :: java string to sql timestamp 
Sql :: alter table add multiple foreign key sql 
Sql :: mysql where not equal 
Sql :: sqlite autoincrement 
Sql :: import mysql dump command line 
Sql :: mysql milliseconds 
Sql :: phone no data type in sql server 
Sql :: mariadb hours between two dates 
Sql :: install mysql on ubuntu 
Sql :: select 2 rows in sql 
Sql :: getdate function in postgresql 
Sql :: sqlite reset autoincrement 
Sql :: rename table column name in mysql 
Sql :: alter table add column in sql server 
Sql :: soql last week 
Sql :: sql select count distinct 
Sql :: osx stop mysql service 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =