Read Only access to all databases to a user in a SQL Server Instance

  • Comments posted to this topic are about the item Read Only access to all databases to a user in a SQL Server Instance

  • Hi and thanks for taking the time to post your script.  It appears a space is missing before the 'FOR LOGIN' in the dynamic sql below:


    SELECT @SQL = 'USE '+ '[' + @DatabaseName + ']' +'; '+ 'CREATE USER ' + @User +     'FOR LOGIN ' + @User + '; EXEC sp_addrolemember N''db_datareader'',     ' + @User + '';


    Again, many thanks, and like that you factored in system and logshipped db's.

    Take care,
    Tom

  • Thanks, it is very useful!

    --------------------------------------
    ;-)“Everything has beauty, but not everyone sees it.” ― Confucius

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

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