我想写一个像下面这样的存储过程
allInterestingKeys = SELECT MyKey FROM MyTable WHERE CreatedDate < CAST('2013-01-01' AS date)
DELETE MyTable01 WHERE MyKey IN allInterestingKeys
DELETE MyTable02 WHERE MyKey IN allInterestingKeys
...
DELETE MyTable10 WHERE MyKey IN allInterestingKeys
理想情况下,我只想运行SELECT MyKey FROM MyTable WHERE ...
一次以使程序比
DELETE MyTable01 WHERE MyKey IN (SELECT MyKey FROM MyTable WHERE CreatedDate < CAST('2013-01-01' AS date))
DELETE MyTable02 WHERE MyKey IN (SELECT MyKey FROM MyTable WHERE CreatedDate < CAST('2013-01-01' AS date))
...
DELETE MyTable10 WHERE MyKey IN (SELECT MyKey FROM MyTable WHERE CreatedDate < CAST('2013-01-01' AS date))
最好的编码方式是什么?谢谢。