Very cool exercise. I needed to revise the create table T-SQL to the code below in order for it to work for me.
-- Check if destination table already exists, If it does not, execute the create table statement
IF NOT EXISTS (SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(@TableName) AND type in (N'U'))
begin
EXEC (@TableCreateCmd)
end
I was using SQL 2005.
Thanks!
bigcraiginjax