Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql update multiple columns

UPDATE table_name SET column1=value1, column2=value2 WHERE condition
Comment

update multiple columns in sql

UPDATE table-name SET column-name = value, column-name = value WHERE condition = value
Comment

update table sql multiple set

-- CANT do multiple sets but can do case
UPDATE table
SET ID = CASE WHEN ID = 2555 THEN 111111259 
              WHEN ID = 2724 THEN 111111261
              WHEN ID = 2021 THEN 111111263
              WHEN ID = 2017 THEN 111111264
         END
WHERE ID IN (2555,2724,2021,2017)
Comment

sql update multiple tables

/*You can't update multiple tables in one statement,
however, you can use a transaction to make sure that
two UPDATE statements are treated atomically.
You can also batch them to avoid a round trip.*/


BEGIN TRANSACTION;

UPDATE Table1
  SET Table1.LastName = 'DR. XXXXXX' 
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = '011008';

UPDATE Table2
SET Table2.WAprrs = 'start,stop'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = '011008';

COMMIT;
Comment

PREVIOUS NEXT
Code Example
Sql :: sql highest salary by location 
Sql :: update join 
Sql :: not operator in sql 
Sql :: SQL get max per id 
Sql :: oracle ora-00054 how to unlock 
Sql :: TRIGGER AFTER 
Sql :: get specific column in mongodb 
Sql :: postgresql find blocked query 
Sql :: union syntax in oracle 
Sql :: SQL DATEDIFF(date_part, start_date, end_date) 
Sql :: sql store procedure 
Sql :: mysql autoincrement valor inicial 
Sql :: desinstaller mysql sur ubuntu definitivement 
Sql :: order of execution in sql 
Sql :: create temp table sql 
Sql :: compression of dabatase mysqldumo 
Sql :: how to login to mysql as normal user in ubuntu 
Sql :: mysql not null 
Sql :: sql max value in column 
Sql :: SQL IN Operator With Subquery 
Sql :: identify rows with 2 same column value and delete duplicate mysql 
Sql :: soql- select all fields 
Sql :: select only columns that are not empty oracle sql 
Sql :: SQL CREATE INDEX Constraint 
Sql :: sql to excel pgadmin 
Sql :: remove duplicates mysql 
Sql :: sqlite trim 
Sql :: incorrect datetime value sql table error 1292 
Sql :: not in in mongodb 
Sql :: sql output parameters 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =