Re: Sql Management Studio - Script Db creates objects out of ourder
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Tue, 16 Jan 2007 15:09:05 -0800
Andrew Robinson (nemoby@xxxxxxxxxxxxx) writes:
Don't know if this is the best place to post this but I have a db with
about 100 tables and a number of views and sprocs. When scripting the
entire db using SMS, a number of the views and sprocs are created before
their associated underlying tables are. Can anyone shine a bit of light
on this issue? I am guessing that it is a common one since I have seen
it a number of times.
I have also tried the new Database Deployment Wizard RC and it generates
scripts with the same issue. Guessing that maybe this has something to do
with my db?
Scripting depends on the dependency information in the database. Given the
flexible nature of SQL Server, this information may be incomplete. If you
create a table nissetbl, and the a stored procedure kalle_sp that refers
to nissetbl, SQL Server with store information about this. But if you
now drop and recreate nissetbl, this information is lost. When you recreate
nissetbl, it would be kind of expensive to examine 5000 stored procedures
to see if they might refer to nissetbl. Also, keep in mind that SQL Server
to permits you to create kalle_sp before nissetbl exists at all.
Thus, the only way to get you generated script correctly is to generate
the database correctly from the beginning. ...or at least it was up to
SP2 of SQL 2005, which introduces a system procedure, sp_refreshsqlmodule
which updates the dependency information for a stored procedure or
similar.
SP2 for SQL 2005 has not been released yet, but a preview (aka CTP) is
available.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Sql Management Studio - Script Db creates objects out of ourder
- From: Andrew Robinson
- Sql Management Studio - Script Db creates objects out of ourder
- Prev by Date: Re: Little Lock Symbols
- Next by Date: Re: Little Lock Symbols
- Previous by thread: Re: Sql Management Studio - Script Db creates objects out of ourder
- Next by thread: Management Studio scripts for SQL 2000
- Index(es):
Relevant Pages
|