Thursday, March 22, 2012

Copying Tables

Hi,

I'd like a really simple way of making a replica of a table. The thing is i'd like the table name to be a variable. The following code doesn't work, any ideas??

Thanks in advance,

Alph

CREATE Procedure Test

@.vMonth as varchar(3)

As

SELECT tbl_Targets.* INTO @.vmonth
FROM tbl_Targets;
GOLook up sp_executesql and EXECUTE in the SQL Books Online.

No comments:

Post a Comment