Export (0) Print
Expand All

Granting Access to a Database

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Mary now has access to this instance of SQL Server, but does not have permission to access the databases. She does not even have access to her default database TestData until you authorize her as a database user.

To grant Mary access, switch to the TestData database, and then use the CREATE USER statement to map her login to a user named Mary.

To create a user in a database

  • Type and execute the following statements (replacing computer_name with the name of your computer) to grant Mary access to the TestData database.

    USE [TestData];
    GO
    
    CREATE USER [Mary] FOR LOGIN [computer_name\Mary];
    GO
    

    Now, Mary has access to both SQL Server and the TestData database.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft