[thelist] MS Access CREATE TABLE

Ken Schaefer ken at adOpenStatic.com
Wed Jan 7 05:42:03 CST 2004


I think Dave has an existing database, and he wants to generate the CREATE
TABLE scripts from the existing database's schema.

With the SQL Server 2000 Query Analyser this is easy to do - right click on
a table in the object browser and choose "script as new", or "script as
alter", and you get the requisite CREATE or ALTER table statements
autogenerated for you.

Cheers
Ken


----- Original Message ----- 
From: "Anthony Johnston" <tech at antix.co.uk>
To: <thelist at lists.evolt.org>
Sent: Wednesday, January 07, 2004 9:05 PM
Subject: RE: [thelist] MS Access CREATE TABLE


: I do this a lot,  however it is not well documented and a lot of hastle
:
: Create a schema (example below),  and then run it through another program
: which executes it line by line using JET.  It has some limitations in that
: you cannot set all the properties of a field using this method such as
: 'allow zero length'.
:
: It would be better for you in the long run to migrate to MS SQL Server or
: MySQL.
:
: Ant.
:
: --------------------------------------------------------------------------
-
:
: Example Script,  this can be executed through JET (Execute at each ;)
:
: CREATE TABLE sys_tu_user(
: sys_u_id TEXT(25) NOT NULL,
: sys_u_created DATETIME NULL,
: sys_u_super TINYINT DEFAULT 0 NOT NULL,
: sys_lock TEXT(25) DEFAULT "",
: sys_updated TIMESTAMP NULL,
: CONSTRAINT sys_iu_primaryKey PRIMARY KEY(sys_u_id));
:
: CREATE TABLE sys_ts_session(
: sys_s_id AUTOINCREMENT,
: sys_u_user TEXT (25) NOT NULL,
: sys_s_started DATETIME NOT NULL,
: sys_s_ended DATETIME NOT NULL,
: sys_s_referer TEXT(250) NOT NULL,
: sys_s_headers TEXT NOT NULL,
: sys_s_browser TEXT(100) NOT NULL,
: CONSTRAINT g_iu_primaryKey PRIMARY KEY(sys_s_id));
:
: CREATE TABLE sys_tsP_sessionPage(
: sys_sP_id AUTOINCREMENT,
: sys_s_session INT NOT NULL,
: sys_sP_page TEXT(100) NOT NULL,
: sys_sP_queryString TEXT(250) NOT NULL,
: sys_sP_dateTime DATETIME NOT NULL,
: CONSTRAINT sys_rs_session FOREIGN KEY (sys_s_session) REFERENCES
: sys_ts_session (sys_s_id),
: CONSTRAINT g_iu_primaryKey PRIMARY KEY(sys_sP_id));
:
:
: -----Original Message-----
: From: thelist-bounces at lists.evolt.org
: [mailto:thelist-bounces at lists.evolt.org] On Behalf Of David Mitchell
: Sent: 07 January 2004 01:33
: To: thelist at lists.evolt.org
: Subject: [thelist] MS Access CREATE TABLE
:
: Hi Folks,
:
: I am stuck working with an MS Access database. I am much more familiar
: working with SQL Server. This leads me to my question: Is there any way to
: generate CREATE TABLE scripts for all the tables in an access database
sorta
: the same way one can do this with SQL Server?
:
: Can't seem to find anything in Access "Help" (the paperclip ain't helping
me
: much...) or on Google.
:
: Thanks!



More information about the thelist mailing list