Create a user with db owner access level in SQL server

Posted on 2008-11-18
Last Modified: 2013-12-07
I have a database in SQL server 2000 I want to migrate this database to SQL server 2005. I have created the database login in SQL server 2005 that the user in DB SQL 2000 uses. I then want to be sure if the user has the DB_OWNER role on the database. I can check this using the SP_HELPLOGINS sotored procudure, if there is not a entry for my loginname on the restored sql2005 db and a memeberOf the db_owner role, how do I create that user or update it so it does have db_owner access. I can do this through the studio but dont know the SQL syntax for it.
Question by:m3housing
    LVL 60

    Accepted Solution

    to give it access to the role:

    exec sp_addrolemember 'db_owner', 'yourusername'

    Author Closing Comment

    cheers dude your a legend, I thought I might be able to do it when I created a user so was searching the web for that syntax.
    LVL 60

    Expert Comment

    Well...Im certainly not a legend, but I appreciate the complement....glad to help.
    LVL 2

    Expert Comment

    by:Robert Silver
    or you can type in the sql and click on execute within sql Management studio:

    create login xyz with password='pwd',check_policy=off, check_expiration=off,default_database=xyzdb;
    create user xyz for login xyz;

    You may have to run the sp_srvrolemember 'currentuser', 'sysadmin';   first to have ample

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
    This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now