SQL 2000: scripting and ownership

From: Bill Morris (seamlyne_at_hotmail.com)
Date: 07/06/04


Date: 6 Jul 2004 10:36:51 -0700

Windows 2000/2003 Server, MS SQL Server 2000

I've got an issue with scripting and object ownership. There are
three logins/users of our database, and the main ASP application uses,
for example, "USER1". For a variety of reasons, I've gotten out of
the habit of using DTS:Copy Objects and Data (that misses defaults and
primary keys, for starters) and DTS:Copy table(s)... (that assigns any
object transferred to whatever you login with - WRONG!) to move things
around. My method, while a little lengthy, works very well: script
all objects and run the script in the appropriate database in Query
Analyzer. Then login source and destination in each of the three
users/logins and transfer only those objects owned by the logins.
Simple, effective, almost fool proof.

Now, however, I'm getting some odd behavior. Certain objects are
being scripted without the owner name, particularly in views and
stored procedures. Where the view on SVR_SOURCE would say "select
firstname, lastname from owner2.People" it's being scripted as "select
firstname, lastname from People", and the view creation fails because
there is no "{implied dbo.}People".

In this database there are ~60 views, ~500 stored procedures, ~400
tables. Fixing the scripts by hand would not be a pleasant task. Any
ideas what's going on? Something in Windows 2003 where the scripting
is being done? Something in the SQL Server settings on the 2003
server?

 - Wm
William Morris, Seritas LLC
Liberty, Missouri USA



Relevant Pages

  • Re: How to Create Local Temporary Table
    ... I have worked with both Oracle and SQL Server for some time and have grown to appreciate how much more mature Oracle is than SQL Server. ... When most think of scripting in Windows, they think of DOS command line scripting. ...
    (comp.databases.oracle.server)
  • Re: Sql Management Studio - Script Db creates objects out of ourder
    ... Scripting depends on the dependency information in the database. ... flexible nature of SQL Server, ... and the a stored procedure kalle_sp that refers ... to nissetbl, SQL Server with store information about this. ...
    (microsoft.public.sqlserver.tools)
  • Re: Scripting Performance after SP2 applied?
    ... I agree that there is a lot of time spent setting up the scripting in the ... As far as memory configuration, I have always set my max server memory set ... now with forced parameterization, ... I then restarted SQL Server, and set the database to forced ...
    (microsoft.public.sqlserver.tools)
  • Re: SMSS SP2 Script Database objects error
    ... Determining objects in database 'NameHost' that will be scripted. ... query using ANSI outer join operators (LEFT OUTER JOIN, ... In the future versions of SQL Server, ... scripting, I find it difficult to believe that it would be that bad. ...
    (microsoft.public.sqlserver.tools)
  • Re: Any good, free tools for writing simple stored procedures?
    ... I use SQL Server Query Analyzer most of the time. ... but it does have a debugger, object browser, scripting, graphical query ... from the object browser into the editing window. ...
    (microsoft.public.sqlserver)

Quantcast