sql update alias 1

sql update alias

UPDATE t
SET t.COLUMN = 'UPDATE'
FROM DATABASE_TABLE t
WHERE t.ID = 1;

Here is what the above code is Doing:
1. It’s creating a temporary table called #TEMP_TABLE.
2. It’s inserting the data from the DATABASE_TABLE into the #TEMP_TABLE.
3. It’s updating the data in the DATABASE_TABLE.
4. It’s deleting the data in the DATABASE_TABLE.
5. It’s inserting the data from the #TEMP_TABLE into the DATABASE_TABLE.
6. It’s dropping the #TEMP_TABLE.

Similar Posts