开发者

Drop and create table inside transaction on SQL Server, impact on other processes

开发者 https://www.devze.com 2023-02-12 22:38 出处:网络
On SQL Server 2005, is it possible to drop and recreate a table (copy from another database) inside of a transaction?

On SQL Server 2005, is it possible to drop and recreate a table (copy from another database) inside of a transaction?

Also, would any process trying to access that table during the transaction fail or w开发者_Go百科ait for the transaction to complete?


Copy the data into a different table, then switch the old and new tables. Use either sp_rename or see Transferring Data Efficiently by Using Partition Switching. The later option is better because it preserves all permissions and constraints on the table, but it does require Enterprise Edition.

0

精彩评论

暂无评论...
验证码 换一张
取 消