Search
 
SCRIPT & CODE EXAMPLE
 

SQL

insert or update sql query

REPLACE INTO devices(id,name) 
VALUES 
   (4,'Central Printer')
Comment

update or insert sql

begin tran
if exists (select * from table with (updlock,serializable) where key = @key)
begin
   update table set ...
   where key = @key
end
else
begin
   insert into table (key, ...)
   values (@key, ...)
end
commit tran
Comment

PREVIOUS NEXT
Code Example
Sql :: pgadmin check database 
Sql :: sql order of operations 
Sql :: sqlite clear shell 
Sql :: mysql query where in select 
Sql :: not operator in sql 
Sql :: plpgsql coalesce equivalent for empty string 
Sql :: oracle cpu metric 
Sql :: Caused by: java.lang.RuntimeException: Unable to obtain credentials to communicate with the Cloud SQL API 
Sql :: hidden error sql codeigniter 3 
Sql :: time in sql server 
Sql :: sqlite create record 
Sql :: c# sql conennection string 
Sql :: SQLSTATE[42000]: Syntax error or access violation: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause 
Sql :: Postgres format number to 2 decimal places 
Sql :: sql server size of every table in a db 
Sql :: List all the items that have not been part of any purchase order. sql 
Sql :: SELECT ALL TABLE INFO 
Sql :: rename temp table column name in sql server 
Sql :: pl sql if boolean 
Sql :: sql select where id not exists in another table 
Sql :: truncate table sql server foreign key 
Sql :: grapgql 
Sql :: sql creating tables 
Sql :: insert into table sql 
Sql :: what does leave do in mysql 
Sql :: drop table oracle 
Sql :: wp_query raw sql 
Sql :: find the names of sailors who have reserved at least one boat 
Sql :: how to close external sql connection in laravel 
Sql :: xampp reset mysql 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =