What's the SQL for adding a field to a table? And can you direct me to the
documentation. Is it an ALTER TABLE?you got it
alter table is it.
google alter table
"Les Stockton" <LesStockton@.discussions.microsoft.com> wrote in message
news:A45A259E-D86C-4B19-B923-A39BFCE0255E@.microsoft.com...
> What's the SQL for adding a field to a table? And can you direct me to
> the
> documentation. Is it an ALTER TABLE?|||Alter table add <columnname> <datatype>
"Les Stockton" <LesStockton@.discussions.microsoft.com> wrote in message
news:A45A259E-D86C-4B19-B923-A39BFCE0255E@.microsoft.com...
> What's the SQL for adding a field to a table? And can you direct me to
> the
> documentation. Is it an ALTER TABLE?|||Yes it's the ALTER TABLE statement.
If you look in BOL it's under ALTER TABLE, but the code is :
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL
Adam J Warne, MCDBA
"Les Stockton" wrote:
> What's the SQL for adding a field to a table? And can you direct me to th
e
> documentation. Is it an ALTER TABLE?|||Yes, it's:
ALTER TABLE table_name ADD col_name col_type col_nullability;
For example,
ALTER TABLE T1 ADD col1 INT NOT NULL DEFAULT(0);
SQL Server's Books Online has info about this under ALTER TABLE.
BG, SQL Server MVP
www.SolidQualityLearning.com
"Les Stockton" <LesStockton@.discussions.microsoft.com> wrote in message
news:A45A259E-D86C-4B19-B923-A39BFCE0255E@.microsoft.com...
> What's the SQL for adding a field to a table? And can you direct me to
> the
> documentation. Is it an ALTER TABLE?
No comments:
Post a Comment