Link to home
Start Free TrialLog in
Avatar of quiTech
quiTechFlag for Canada

asked on

SQL Server procedure to create Database from existing Database

Hello,

Does anyone have a SQL stored procedure that reads an existing database schema (tables, views, procedures, and functions) and creates a query that, when run, would create a blank copy of that existing database?

I know I can do this manually from query analyzer, by right clicking on each object and creating the SQL for it.  But, I'm hoping for an automated version :-)

Thanks in advance!
Avatar of quiTech
quiTech
Flag of Canada image

ASKER

... that's SQL Server 2000, btw
ASKER CERTIFIED SOLUTION
Avatar of chiragkhabaria
chiragkhabaria

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DireOrbAnt
DireOrbAnt

Simply script the whole Schema in ONE .sql file, create a new DB and run the .sql in it.
Avatar of quiTech

ASKER

Hi DireOrbAnt,

I know this question has been open for a long time.  Sorry for not replying sooner.

How Do I script "the whole Schema in one .sql"?   I know I can click on each individual object, script to clipboard and past into the same window.  but this seems rather cumbersome.  I'm hoping there is a way to script the whole schema, as you suggest with a single command...

thanks