Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Does "ALTER TABLE" create the physical table file?
Thu, Apr 15 2010 11:00 PMPermanent Link

Richard

ENT Technologies

Hi,

I've started to use the Database Manager to create my databases (much easier than trying to remember the CREATE TABLE syntax). I then reverse engineer the database, which gives me a script. When I deploy my application, I use a TEDBScript component with that script to automatically create a brand new database. Real easy compared to the way I did it before.

I noticed in the script that constraints are not included in the CREATE TABLE, but are added later with an ALTER TABLE statement.

I know that the CREATE TABLE statement doesn't neccessarily create the physical file on the disc immediately. However when I run the script, the files are created. Is this done because of the ALTER TABLE statement?


Fri, Apr 16 2010 3:22 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Richard

>I know that the CREATE TABLE statement doesn't neccessarily create the physical file on the disc immediately. However when I run the script, the files are created. Is this done because of the ALTER TABLE statement?

From my understanding its because CREATE TABLE only creates the columns and the primary key constraint. Everything else is added afterwards. Probably part of the SQL standard.

Roy Lambert [Team Elevate]
Sat, Apr 17 2010 6:32 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Richard,

<< I know that the CREATE TABLE statement doesn't neccessarily create the
physical file on the disc immediately. However when I run the script, the
files are created. Is this done because of the ALTER TABLE statement? >>

Yes, the table is opened in order to alter it, so that is when the table
files are created.

--
Tim Young
Elevate Software
www.elevatesoft.com
Sat, Apr 17 2010 6:33 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< From my understanding its because CREATE TABLE only creates the columns
and the primary key constraint. Everything else is added afterwards.
Probably part of the SQL standard. >>

That was how DBISAM worked, but ElevateDB can create any number of columns
and constraints in a CREATE TABLE call.  It doesn't do so in the
reverse-engineering because of the way that it wants to execute the DDL in
steps.

--
Tim Young
Elevate Software
www.elevatesoft.com
Image