Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 15th, 2006, 03:08 PM
Registered User
Join Date: Mar 2006
Location: Frederick, MD, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Scripting database objects in dependency order

We're building a new application on SQL 2005, requiring a new database and objects. I'm making frequent changes to the objects, often making a specific change to all of the tables. In SQL 2000 I would just script out the database, make my change, and apply the script (assuming that the tables are empty or can be easily refilled).
When I script out the objects in SQL 2005 I get an option to generate create or drop statements, but not both (if exists... drop table). More importantly, the objects aren't scripted in dependency order (i.e. the customer table must be created first but deleted last).

Am I missing something? Is there an option on the scripting wizard to give me the functionality like it was in SQL 2000? Is there anything else I can try, besides writing my own scripting app?

Thanks for listening!


Reply With Quote
  #2 (permalink)  
Old March 15th, 2006, 10:20 PM
Registered User
Join Date: Apr 2005
Location: Shelbyville, KY, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

So there are two issues here...

1. How to generate if exists drop...create?
A. I am not sure how offhand just via Mgmt Studio to accomplish this exact requriement. What I can tell you is that using the Script Wizard (right-click on DB, Tasks, Generate Scripts), you get several options under the General Tab on the "Choose Scripting Options" step including "include if not exists". What this does is if not exists then create so its not exactly what you want aka a straight drop then create but its as close as I can find offhand just via the UIs.

2. How to script dependent DB objects in order?
A. While I am not aware of anyway to specify ordering, you can use the same Script Wizard I mentioned above with another General Script option/setting for dependant DB objects.

Hope this helps,
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multilingual Database Objects Muhammad Zeeshan SQL Server 2000 1 August 13th, 2007 02:56 AM
Scripting Database mike_remember SQL Server 2000 4 October 31st, 2006 10:27 AM
dependency files m002864 Crystal Reports 0 July 7th, 2004 02:56 PM

All times are GMT -4. The time now is 01:12 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.