How do I declare two table variables with identical structures?

Viewed 4518

I have the following table variable declaration:

DECLARE @MyTable TABLE
(
   --ten columns declared here
)

and I want to declare another table variable with identical structure (so that I insert-from-select into the first one and then copy the result into the second one and then I delete entries from the first variable one by one and return the second one as a result).

I tried this:

DECLARE @MyTable, @MyTableCopy TABLE
(
   --ten columns declared here
)

but SQL Server Express is not happy and says

Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ','.

How do I declare two identically structured table variables?

1 Answers
Related