Skip to content

Tag: sql-server

Swap value between rows

I want to swap dynamically values in column VAL2. The case is when in tech I have got X. I want to upload data from other rows where values in cells are the same ( the only difference is EN1 and EN2 ) because values there are reversed. ~~ SQL server I tried to update, case, but I do not

get records that doesnt exists in another table

I have a temp table over a 1000 rows but for example purposes as follows #Table and then i have another table as follows (this is not a temp table) Compliance Table how do i check if the records from the temp table doesnt exists in the Compliance table per its ID and Code so from the above data i

Sql update query using When condition

The example below apply null values into the field nom for the others id, how can forbid this action so that it does not modify the already existing values ​​and that I do not wish to modify ? Answer One way is with else: But if you just want to update the rows that match, then use WHERE: No need