在SQL Server中,可以使用SELECT
語句將insert
轉換為表:
INSERT INTO Table (col1, col2, col3)
SELECT col1, col2, col3
FROM other_table
WHERE sql = 'cool'
還可以透過SELECT
更新嗎?我有一個包含值的臨時表,並想使用這些值更新另一個表.也許是這樣的:
UPDATE Table SET col1, col2
SELECT col1, col2
FROM other_table
WHERE sql = 'cool'
WHERE Table.id = other_table.id