ALTER TABLE help

ALTER TABLE help

Post by bill.c.kin » Sat, 03 May 2003 23:29:38



Can you use the alter table command on a table variable?  I am trying to
convert rows from a resultset into columns of a table.  I can get it to work
using a temp table, just though it would be faster with a table variable.

TIA

Bill

 
 
 

ALTER TABLE help

Post by Aaron Bertrand - MV » Sat, 03 May 2003 23:47:47


Quote:> Can you use the alter table command on a table variable?

No, from http://support.microsoft.com/?kbid=305977:

"The table definition cannot be changed after the initial DECLARE
statement."

Quote:> just though it would be faster with a table variable.

Not necessarily.  You should try both with your usage, structure and data.
That way you can make an educated choice for your exact scenario.

 
 
 

ALTER TABLE help

Post by bill.c.kin » Sat, 03 May 2003 23:52:50


Thanks



Quote:> > Can you use the alter table command on a table variable?

> No, from http://support.microsoft.com/?kbid=305977:

> "The table definition cannot be changed after the initial DECLARE
> statement."

> > just though it would be faster with a table variable.

> Not necessarily.  You should try both with your usage, structure and data.
> That way you can make an educated choice for your exact scenario.