Access ADP Project, SQL Table Creation Statements

I have a Microsoft Access(.adp) project with 16 tables in it. I'm running MSDE so that tables are in SQL server. I need to output the create statements for the tables and the attributes of each table, plus the primary key/foreign key relations how do I do it??

I need statements like this:
Create table firstcare_centers (
center_id            decimal(4) not null,
center_name      varchar(15),
pharmacy_id      decimal(4) not null,
pharmacy_name      varchar(50),
address            varchar(60),
city                  varchar(15),
state            varchar(4),
zip_code            varchar(10),
phone_number      varchar(13),
upsize_ts            timestamp(2),
Primary Key(center_id));




Create table independent_contractors (
contractor_id      decimal(4) not null,
first_name      varchar(10) not null,
last_name            varchar(20) not null,
pager            decimal(13) not null,
speciality      varchar(50) not null,
center_id            decimal(4),
Primary Key(contractor_id),

Constraint fk_firstcare_centers_independent_contractors foreign key(center_id)
References firstcare_centers ON DELETE cascade);




Create table center_physician_schedule
Contractor_schedule_id      decimal(4),
Date                              date,
Start_time                  timestamp(2),
End_time                        timestamp(2),
Center_id                        decimal(4),
Contractor_id                  decimal(4),
Primary key(contractory_schedule_id),

Constraint fk_center_physician_schedule_independent_contractors foreign key(contractor_id)
References independent_contractors on delete cascade,

Constraint fk_center_physician_schedule_firstcare_centers foreign key(center_id)
References firstcare_centers on delete cascade);



Create General_employee_information
Employee_id                  decimal(4),
Social_security_#            varchar(50),
First_name                  varchar(10),
Middle_name                  varchar(20),
Last_name                        varchar(20),
Address                        varchar(60),
City                              varchar(15),
State                        varchar(4),
Zip_code                        varchar(10),
Phone_number                  varchar(13),
Employement_location      varchar(10),
Center_id                        decimal(4),

Constraint fk_general_employee_information_firstcare_centers foreign key(center_id)
References firstcare_centers on delete cascade);
ZeoAsked:
Who is Participating?
 
SashPCommented:
Zeo

I know that you haven't mentioned Enterprise Manager, however I know that you are using it.

The easiest way to create the scripts to create your database including all tables, indexes, keys, relationships etc is to use Enterprise Manager.

Right Click on your database in Enterprise Manager and select "All Tasks" -> "Generate SQL Script"

Select the required options and jobs done.

Cheers Sash
0
 
arbertCommented:
There are several ways you could do it.  Probably the easiest?  Create a passthru query in your ADP project and use the SP_OA stored procs in SQL Server to use the SQLDMO.  There are some examples at this site:

http://www.databasejournal.com/features/mssql/article.php/2205291
0
 
ZeoAuthor Commented:
Albert, I'm confused. I looked at that site but I'm not following SQLDMO.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
arbertCommented:
What aren't you following?

This line:  EXEC @hr = sp_OACreate 'SQLDMO.SQLServer', @object OUT

Creates the SQLDMO object on the server.  SQLDMO is the object model that Enterprise manager uses to do things within SQL Server.  This is also the programming extension programmers can use to access the same functionality in their programs.

Brett
0
 
ZeoAuthor Commented:
I'm really new to databases in general. I wrote out the create statements on my own with the primary keys, and foreign keys, but I was hoping to be able to do it directly from Access and my MSDE backend. I put the files I've created up on my website at http://www.techcacophony.net/firstcare/. I'm following an example laid out in Shcuams SQL case outlines. What I'd like to do it adapt the example from the book into MSDE.

I need really explicit steps. I have MSDE installed and I have the enterprise manager running, and I've got Visual Studio installed, so what tools do I need to use.

Many thanks and if I can get this foundation built, I'll award an additional 500 points for a grand total of 1000
0
 
arbertCommented:
"Many thanks and if I can get this foundation built, I'll award an additional 500 points for a grand total of 1000 "

There is a limit to 500 points per question....

I think the link I posted above explains pretty clearly how to create scripts using the SQLDMO.  The scripts they have can be posted into Query Analyzer and ran.  It will create stored procedures on your MSDE that you can call from your ADP project...
0
 
ZeoAuthor Commented:
So just to be clear I need to be using VS.net to do this. I'm looking over at this walkthrough right now
http://www.sqljunkies.com/Tutorial/1BFBD444-DCB2-4318-A315-56BCA1D8C97D.scuk

right track, wrong track?
0
 
arbertCommented:
"So just to be clear I need to be using VS.net to do this."

No, you just need to code it with something that can instantiate   an object (VBA in access will work nicely).
0
 
arbertCommented:
"however I know that you are using it."  You have ESP?  What's my bank account balance?

EM manager will generate a "point in time" script, but if it's something you want to do continually, SQLDMO is the way to go (that's what EM uses under the covers too).
0
 
SashPCommented:
Hi Brett

I helped him yesterday on another problem.  And after reading the rest of the posts here he actually mentions EM.  An yes I do have esp and your bank balance is ok, although you could be maximising your tax effective investments better.

I do not disagree with you that EM will create a point in time script. However generally this is what is required, and the question did not specify where point in time or dymanic creation is required.

Cheers Sash
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.