How to create a login with default database role "db_datareader"

  • i have created a login by using the following script

    >create login xxxxxx with password ='yyyyy',check_policy=off,check_expiration=off ----for creating

    >deny view any database to xxxxxx ----to deny the view

    >alter authorization on database ::DB_Name to xxxxxx ---to grant the view on particular DB

    But here by default the database roll "db_owner" role,

    i tried to change the db role from owner to Reader but it is showing an error like "Cannot use the special Pricipal dbo".

    If want to change it to "db_datareader" role what can i do...

    Regards
    Chowdary...

  • It seems like you want to create a user that should only see the databases on the server it has access to. This is unfortunately not possible. You can make the user owner of the database, but as the owner the user can do anything in the database.

    The user will need to learn to say "USE mydb".

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

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

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