Sunday, February 19, 2012

add column to a existing table.

Hello,
Can you add a column to an existing table and tell it that you want it
between existing columns as opposed to the end in an sql statement?
Thx"Jim" <zzaro@.excite.com> wrote in message
news:u9pPfe2VGHA.4956@.TK2MSFTNGP09.phx.gbl...
> Hello,
> Can you add a column to an existing table and tell it that you want it
> between existing columns as opposed to the end in an sql statement?
> Thx
>
No. You would have to drop and re-create the table. If you follow good
coding practices (don't use SELECT * in production code for example) then
you can eliminate or minimize any effect of the column order in your
tables - at least as far as end users are concerned.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||if you profile a database while you do this through EM you'll see it
actually creating a new table, inserting into it, then dropping the
original, then renaming the new one.
not that that helps you, but I found it interesting|||You don't need to run profiler to do this, if you click on the save
change script icon (3rd from the left) all the code will be there
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thanks guys!
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1144177330.950506.145550@.i40g2000cwc.googlegroups.com...
> You don't need to run profiler to do this, if you click on the save
> change script icon (3rd from the left) all the code will be there
>
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>

No comments:

Post a Comment