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.
精彩评论