0
我有大约40个删除查询语句的过程中用于从多个表中为外键记录删除记录。多个删除SQL Server中的过程中的查询
例如
Create Proc usp_delete_record(@id int)
as
Begin
Delete from table1 where [email protected];
Delete from table2 where [email protected];
Delete from table3 where [email protected];
Delete from table4 where [email protected];
Delete from table5 where [email protected];
Delete from table6 where [email protected];
Delete from table7 where [email protected];
Delete from table8 where [email protected];
....................
.................
Delete from table40 where [email protected];
End
这是非常慢或挂起执行。
如何处理?
你在表格上有适当的索引? (id列) – Recursive 2014-10-08 05:23:23
检查下面的链接使用单个查询从多个表中删除:http://stackoverflow.com/questions/20417303/single-query-to-delete-from-multiple-tables-in-sql-server – 2014-10-08 05:49:28