SQL: cross-table updates
Because I always forget how to do it, and always have to look up the syntax... Here's how to update table A with values from table B.
SET name = B.name
FROM B
WHERE A.id = B.id;
Because I always forget how to do it, and always have to look up the syntax... Here's how to update table A with values from table B.
I'm full of complaints lately. I spent a great deal of time writing a beautifully formatted, very human readable SQL query. Then I saved it as a view and SQL Server was kind enough to reformat it as a big block of text, horribly aligned, impossible to read. Die in a fire, Microsoft.