Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i get DDL from Existing SQL Database

Status
Not open for further replies.

MattRichardsUK

Technical User
Dec 11, 2000
22
0
0
GB
I am trying to get the entire DDL for my existing SQL Server 2005 database extracted into a .sql file is this possible? and if so is there a set SQL code to accomplish this?
Thanks
M
 
From BOL:

1. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.

2. Expand Databases, right-click any database, point to Tasks, point to Generate Scripts, and then follow the steps in the Generate Scripts Wizard.


--Adam
--"He who knows best knows how little he knows." - Thomas Jefferson
 
Thanks for your speedy reply. I was a liitle trigger happy when it came to the 2005 its actualy sql server 7. I cant find an object explorer in this one.
 
My 1st response, of course, (after making twisted faces at the screen) is to tell you to upgrade. Nonetheless, I believe you would go into Enterprise Manager (They had that in 7.0, right? [smile]), right-click the database name, click "All Tasks", and then "Generate SQL Scripts". At least that's how it was in 2000 and I believe it was the same for 7.0


--Adam
--"He who knows best knows how little he knows." - Thomas Jefferson
 
:))) I imagine your faces :) I would have searched for the link on SQLAuthority for this, but no need now...
 
Thanks for the help yesterday, sadly I am on contract at a company that only have the following options available to them via the 'sql server 7.0' program menu:
Books Online
Client network Utility
Enterprise Manager *
Import and Export Data
MSDTC Administrative Console
Profiler
Query Analyzer
Uninstall SQL Server 7.0

*Unable to use Enterprise manager to connect to the database as the message returned tells me to connect via SQL Server Managment Studio.

Any help in getting the full database DDL would be great.
Thanks again.
M
 
Looks like you have the 7.0 tools installed on your local machine but the server you're trying to connect to is 2005. You need to install the 2005 tools and then use my first suggestion.


--Adam
--"He who knows best knows how little he knows." - Thomas Jefferson
 
Another solution without using sqlserver is using a datamodel tool like Erwin, visio, powerdesigner to do a reverse engineering for a table and generate ddl from the model.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top