Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Backup of the structure of a database

Author  Topic 

winsletmathew
Starting Member

2 Posts

Posted - 2008-11-06 : 06:29:01
How to take the backup of the structure of the database, that includes structure of tables and script for procedures.

Please if any one can find the solution

Thanks,
winslet

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-11-06 : 06:35:44
You could take a backup. Mount it !!! *** SOMEWHERE ELSE *** !!!. Then TRUNCATE all the tables in the new database. Then you could backup that database and you have a backup with all your schema / logic and no data.

There's probably a better way though.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-06 : 07:25:30
You can make use of Generate Scrip feature from Enterprise Manager

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-11-06 : 07:39:30
yeah -- do that, much safer.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-06 : 07:43:56
quote:
Originally posted by Transact Charlie

yeah -- do that, much safer.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION


Your signature seems to be interesting
Any hidden message?



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-11-06 : 07:49:31
Interesting article on using oSQL and stored procedure to programmatically script and run script to create all database objects. No need to individually script and /or run script for each object.

http://www.sqlservercentral.com/articles/scripting/64558/
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-11-06 : 07:54:47
quote:
Your signature seems to be interesting
Any hidden message?


Unfortunately yes. Selected a block of code in a QA window and *just* missed the first vital line "BEGIN TRANSACTION"

Didn't loose any data. Luckily my script was exactly right. But i did get a bit of a fright.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -