I would like 2 session variable to be used if possible:
There are tables in DB1 that I need to copy to @DBname.
I want a procedure where I just have to modify @TableName and @DBname at the top of the procedure, and then Execute.
I then want the procedure to copy DB1.@TableName to @DBname.@TableName.
The only way I know to do this would be to create @DBname.@TableName using the CREATE STATEMENT from DB1.@TableName to preserve indexes/comments/other characteristics of the table. Then use an 'insert' to copy the records.
In any event - can someone write me the procedure?