- Category: Transact-SQL
Hmm... I was writing a stored procedure that will scramble data given a table as a parameter. Because I only want to update a temporary table and not the original (source) table, I needed the following stored procedure (or part of).
This will copy a given table into a temporary table all the while maintaining the structure and data.
Thinking inside of the box
I think everyone suggests the following (or at least the idea of):
SELECT * INTO #MyTempTable FROM @GivenTableIf @GivenTable is a parameter then the above will simply return an error. Also, if it was this easy, I wouldn't need to post this note on my website.