SQL script out of a table

T

taccea

I have an Access2000 table I would to try creating via VB.
Is there a way to open the table in design mode and ask it to generate a SQL
script so I can run in VB and have it create it, so I can create fields on
the fly?

Thanks

Taccea
 
D

Douglas J. Steele

No, there isn't. There are some third party products that'll let you do
that, but my choice would be to use DAO to create the tables.
 
P

Philibin

I have an Access2000 table I would to try creating via VB.

There are a few ways to go about doing it. The easiest way is a make table
query, but you could also just run the SQL for it like this:

SELECT "field1" AS Expr1, "field2" AS Expr2, "field3" AS Expr3 INTO testbl;

Hope that helps...

-Bill
 
J

Jamie Collins

I have an Access2000 table I would to try creating via
VB.
There are a few ways to go about doing it. The easiest way is a make table
query, but you could also just run the SQL for it like this:

SELECT "field1" AS Expr1, "field2" AS Expr2, "field3" AS Expr3 INTO testbl;

I wrote a little app that would produce a simple SQL DDL
script, essentially a CREATE TABLE with all the columns,
including data type mappings, max character width or
numeric scale/precision, NULL or NOT NULL, any DEFAUL
values and testing for things such as reserved works,
illegal characters, presence of IDENTITY (autonumber)
properties, etc. Soon I wanted the PRIMARY KEY
constraints, logically followed by the FOREIGN KEYS so I
had to also include UNIQUE INDEX constraints.

I did it for the learning process and for fun but my point
is, it gets complicated e.g. just my CColumn class module
comprises 2000 lines of code. A third party app could be
appealing...

BTW I use ADO's OpenSchema method.

Jamie.

--
 
T

taccea

Thaks for your input

taccea
Jamie Collins said:
I wrote a little app that would produce a simple SQL DDL
script, essentially a CREATE TABLE with all the columns,
including data type mappings, max character width or
numeric scale/precision, NULL or NOT NULL, any DEFAUL
values and testing for things such as reserved works,
illegal characters, presence of IDENTITY (autonumber)
properties, etc. Soon I wanted the PRIMARY KEY
constraints, logically followed by the FOREIGN KEYS so I
had to also include UNIQUE INDEX constraints.

I did it for the learning process and for fun but my point
is, it gets complicated e.g. just my CColumn class module
comprises 2000 lines of code. A third party app could be
appealing...

BTW I use ADO's OpenSchema method.

Jamie.
 
Top