Fast replace table in T-SQL with another
<p>I have two tables with same structure (keys/columns/etc). I want to replace data in first table with data from second one. I use following code to do it:</p>

<pre><code>DROP TABLE T1

SELECT *
INTO T1
FROM T2

DROP TABLE T2
</code></pre>

<p>but this code is slow enough when T2 is large. T2 table is temporary so I want to rewrite it as:</p>

<pre><code>drop table T1

EXEC sp_rename 'T2', 'T1'
</code></pre>

<p>This should execute very fast for any size table, but am I missing something here? Some side effects that may break this code? I'm not very familiar with dynamic SQL so please advice.</p>