Click here to Skip to main content
Click here to Skip to main content

SQL SERVER - 2005 - Create Script to Copy Database Schema and All The Objects - Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects

By , 21 Aug 2007
 

Following quick tutorial demonstrates how to create T-SQL script to copy complete database schema and all of its objects such as Stored Procedure, Functions, Triggers, Tables, Views, Constraints etc. You can review your schema, backup for reference or use it to compare with previous backup.

Step 1 : Start

Step 2 : Welcome Screen

Step 3 : Select One or Multiple Database

If Script all objects in the selected database checkbox is not selected it will give options to selected individual objects on respective screen. (e.g. Stored Procedure, Triggers and all other object will have their own screen where they can be selected)

Step 4 : Select database options

Step 5 : Select output option

Step 6 : Review Summary

Step 7 : Observe script generation process

Step 8 : Database object script generation completed in new query window

Reference : Pinal Dave (http://www.SQLAuthority.com), All images are protected by copyright owner SQLAuthority.com

Pinalkumar Dave is the author of over hundreds of SQL Server articles. He has five years experience as a Director of Technology and Principal Database Administrator in MS SQL Server 2005/2000 and ColdFusion MX. He has a Masters of Science degree in Computer Networks, along with MCDBA, MCAD(.NET) and ColdFusion Advanced MX Certifications.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

pinaldave
Founder http://blog.SQLAuthority.com
India India
Member
Pinal Dave is a Microsoft Technology Evangelist (Database and BI). He has written over 2200 articles on the subject on his blog at http://blog.sqlauthority.com. Along with 8+ years of hands on experience he holds a Masters of Science degree and a number of certifications, including MCTS, MCDBA and MCAD (.NET). He is co-author of two SQL Server books - SQL Server Programming, SQL Wait Stats and SQL Server Interview Questions and Answers. Prior to joining Microsoft he was awarded Microsoft MVP award for three continuous years for his contribution in community.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 1memberGleinJax22 Jan '11 - 3:25 
This is not an Article, it's a bunch of screen shots.
GeneralMy vote of 1memberYazeed Hamdan24 Oct '10 - 7:42 
not an article
GeneralIs it possiblememberhesaigo999ca5 Jun '09 - 9:58 
Is it possible to run this each night to make daily backups, or is it too large a load for the db...I would like something that records just the changes....could it be be modified to review if there were changes?
GeneralMy vote of 1membergguidarelli1 May '09 - 2:00 
This "article" is just a bunch of screen shots. A more useful article would be to at least explain some of the less-obvious script options.
QuestionHow to create a new DB schema from existing DB using C#?membersur15039 Mar '08 - 23:54 
Hi Pinal,
 
Good Article.
I want to create a database schema from the existing database using C#.
Can you please give me some solution.
 
Thanks,
Suren...
 
Thanks,
Sur...

GeneralStrange "article"memberJim Crafton22 Aug '07 - 8:28 
This "article" has nothing to do with C++, and seems more like a promotional blurb for using a product's wizards. Shouldn't this be under the "Product Showcase" category?
 
¡El diablo está en mis pantalones! ¡Mire, mire!
 
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
 
SELECT * FROM User WHERE Clue > 0
0 rows returned

Save an Orange - Use the VCF!
VCF Blog

GeneralRe: Strange "article"mvpColin Angus Mackay27 Aug '07 - 23:33 
It is very odd, but it actually worked for me. Somehow I'd convinced myself that scripting an entire database wasn't possible in SQL Server 2005 and what a stupid thing to remove that feature. I was googling for a solution expecting some third party tool and I found this instead. I am now sitting here slapping my head wondering why I'd never found the solution on my own. D'Oh! | :doh:
 

Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ...
 
My website

GeneralRe: Strange "article"memberpinaldave28 Aug '07 - 4:57 
Hi Colin Angus Mackay ,
 
Glad you found it useful. I have received similar reactions and emails about this article.
 
However, this is wizard available in SQL Server 2005 many users are looking for how to do it. This was one of the most popular question I have received on my blog so I decided to write about it and have received many reactions just like yours.
 
Regards,

 

Questionwhat's this?memberouyanglibing21 Aug '07 - 18:04 
what's this?
AnswerRe: what's this?memberpinaldave21 Aug '07 - 18:05 
Following quick tutorial demonstrates how to create T-SQL script to copy complete database schema and all of its objects such as Stored Procedure, Functions, Triggers, Tables, Views, Constraints etc. You can review your schema, backup for reference or use it to compare with previous backup.
 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 21 Aug 2007
Article Copyright 2007 by pinaldave
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid