In SQL Server, there is a method to add records to a table with an <code>INSERT.. SELECT</code>
command. Here’s an example of how that works:
INSERT INTO YourTable (columnA, columnB, columnC)
SELECT columnA, columnB, columnC
FROM AnotherTable
WHERE condition = 'example'
Could you let me know if it’s feasible to use a <em>SELECT</em>
statement for updating records in a table? I have a temporary table with data that I need to use to modify another table. A hypothetical example would look like this:
UPDATE YourTable
SET columnA = NewValues.columnA, columnB = NewValues.columnB
FROM NewValues
WHERE YourTable.id = NewValues.id
Any guidance on this would be appreciated!