Assigning dbo permission.

  • I have to create a login and assign the dbo permission to that user

    for a particular database.I know two ways to assign the dbo permission for a particular user.

    1>Create a login and password in EM and in the DatabaseAccess

    check the required database and also check the db_owner.

    2>Create a login and password in EM, login as sa in query analyzer

    and execute exec sp_changedbowner 'newlogin'.

    Is there any difference between these two methods.

  • IMO the big difference is that the user assigned by sp_changedbowner can

    create objects like "create table xyz (col1 int)" and the object will be created as dbo.xyz.

    Members of the db-owner db-group can also perform the same as the actual DBO,

    but if they execute "create table xyz (col1 int)" the table will be owned

    by their userid.

    So the object will be theuser.xyz.

    They have to execute "create table dbo.xyz (col1 int)" to create using the owner dbo.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Another difference I noticed is under the Users context in database

    in EM the dbo will be assigned to the login name which was executed

    using sp_changedbowner, otherwise both the name and login name will be same login name as assinged and checked db_owner in EM.

    Is it true? If true how can I change dbo to point new login using EM.

  • first it will try to find the (unqualified) object using username.object, if it cannot

    find that, it will try with dbo.object.

    If the connected user is the actual database owner, his db-username will actualy be "dbo".

    this is one of the reasons why you should always qualify your objects when you want to use them.

    Tell the system what you know !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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