Sunday, March 25, 2012

Adding a Field

Hello Group,
I am adding a field an SQL table. This field will not be used a PK or FK.
It is just another field to hold data.
My question is at the point of saving the field into the table I get a
screen that says "The following tables will be saved to the database...list
of a bunch of tables". What is that? I am not doing anything to the relate
d
tables at all.
RichRich wrote:
> Hello Group,
> I am adding a field an SQL table. This field will not be used a PK or FK.
> It is just another field to hold data.
> My question is at the point of saving the field into the table I get a
> screen that says "The following tables will be saved to the database...li
st
> of a bunch of tables". What is that? I am not doing anything to the rela
ted
> tables at all.
> Rich
Don't modify your tables using Enterprise Manager - script the changes
using ALTER TABLE, then you can see precisely what error you're running
in to.
All of your database objects should be created/altered using DDL
scripts, and those scripts should be stored safely away in a version
control package.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hello Tracy,
I did not think that it was an error however using a script seems to make
sense. Let me check this.
Rich
"Tracy McKibben" wrote:

> Rich wrote:
> Don't modify your tables using Enterprise Manager - script the changes
> using ALTER TABLE, then you can see precisely what error you're running
> in to.
> All of your database objects should be created/altered using DDL
> scripts, and those scripts should be stored safely away in a version
> control package.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||Rich wrote:
> Hello Tracy,
> I did not think that it was an error however using a script seems to make
> sense. Let me check this.
>
Maybe not an "error", so to speak, but still likely to be something more
meaningful than what you get in Enterprise Manager.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hello Tracy,
I am looking at BOL and do not see anything on adding a field into a
table...I would hate to have to create a new table and then move the data
into the new table...can I just script a new field only?
Rich
"Tracy McKibben" wrote:

> Rich wrote:
> Don't modify your tables using Enterprise Manager - script the changes
> using ALTER TABLE, then you can see precisely what error you're running
> in to.
> All of your database objects should be created/altered using DDL
> scripts, and those scripts should be stored safely away in a version
> control package.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||Oops...
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message news:uk0zkY
FrGHA.3604@.TK2MSFTNGP02.phx.gbl...
Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message news:uk0zkY
FrGHA.3604@.TK2MSFTNGP02.phx.gbl...
Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
<<<<<<<<<<<<<<
I always get tripped up on that syntax.
[vbcol=seagreen]
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>|||I just made that mistake today, that's why I recognized it immediately in th
e post here.
:-)
--
HTH
Kalen Delaney, SQL Server MVP
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:Orbz5lGrGHA.3992@.TK2MSFTNGP04.phx.gbl...
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message news:uk0zkY
FrGHA.3604@.TK2MSFTNGP02.phx.gbl...
Not quite...
Where you're adding a column, you don't use the word COLUMN. I guess it's so
rt of the default.
ALTER TABLE MyTable
ADD MyNewColumn varchar(25) NOT NULL
<<<<<<<<<<<<<<
I always get tripped up on that syntax.
[vbcol=seagreen]
--
HTH
Kalen Delaney, SQL Server MVP
"Arnie Rowland" <arnie@.1568.com> wrote in message news:uPXS6xDrGHA.3856@.TK2M
SFTNGP02.phx.gbl...
Yes, look in BOL for ALTER TABLE.
Example:
ALTER TABLE MyTable
ADD COLUMN MyNewColumn varchar(25) NOT NULL
Also, those messages in Enterprise Mangler happen because if you change a ta
ble, Enterprise Mangler will re-script all related tables. (Behind the scene
s, I believe, Enterprise Mangler will create a new table, transfer the data,
drop the old table, and the rename the new table. Way too much effort just
to add a column!)
--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Rich" <Rich@.discussions.microsoft.com> wrote in message news:35D78AC4-EECD-4E31-BCA8-8FC4F8
DE5E21@.microsoft.com...[vbcol=seagreen]
> Hello Tracy,
>
> I am looking at BOL and do not see anything on adding a field into a
> table...I would hate to have to create a new table and then move the data
> into the new table...can I just script a new field only?
>
> Rich
>
> "Tracy McKibben" wrote:
>

No comments:

Post a Comment