Database Objects not being created with dbo as owner

  • I am using Windows Authentication (SQL Server 2000, SP3). I created a login and database user. I set the user up in the database in the db_Owner Role. When the user creates an object the object is defined with the user's windows account as the object owner. What else do I need to do in order that the user can create objects with dbo as the owner.

    Thanks in advance, Kevin

     

  • One thing would be to use make this script the template :

    Create procedure dbo.SpName

    As

    SET NOCOUNT ON

    SET NOCOUNT OFF

    Go

    That way dbo would be the owner by default .

    I know there's another solution to this one, but it simply fixes the problem after the facts... Maybe there's another ??

  • You can either:

    A. make the user the actual database owner using sp_changedbowner. However, a database can have only one actual owner.

    B. alias the user to dbo using sp_addalias. Any number of users can be aliased. The user assumes the permissions and identity of the alias while in that database. You must drop the user first or sp_addalias will complain that it already exists.

    C. use the owner.objectname syntax when creating objects (create table dbo.mytable...)

    D. use sp_changeobjectowner to change the owner to dbo after it is created.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply