在SQL Server中,可以使用DELETE語句來刪除數據庫中的數據。如果需要批處理刪除多條記錄,可以使用以下幾種技術:
DELETE FROM table_name WHERE age > 30;
DELETE FROM table_name WHERE age IN (25, 30);
DELETE t1
FROM table_name1 t1
JOIN table_name2 t2 ON t1.id = t2.id
WHERE t2.condition = 'value';
DELETE FROM table_name WHERE id IN (SELECT id FROM another_table WHERE condition = 'value');
需要注意的是,在執行DELETE語句時要謹慎,確保刪除的數據是正確的,可以先使用SELECT語句來查看將要刪除的數據,然后再執行DELETE語句。