﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 Administration  / Script to Add User to all Databases / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 21:53:54 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Script to Add User to all Databases</title><link>http://www.sqlservercentral.com/Forums/Topic1050257-1550-1.aspx</link><description>That script doesn't actually work.  But here is one that will:exec sp_msforeachdb 'use [?]; CREATE USER [UserName] FOR LOGIN [UserName];EXEC sp_addrolemember db_datareader, [UserName]'</description><pubDate>Thu, 21 Feb 2013 09:42:14 GMT</pubDate><dc:creator>alexandrialang</dc:creator></item><item><title>RE: Script to Add User to all Databases</title><link>http://www.sqlservercentral.com/Forums/Topic1050257-1550-1.aspx</link><description>This script will add the user to each DB, but you must have the Login created first.It will add the user as a db_datareader role.[code="sql"]sp_msforeachdb 'use [?]; CREATE USER [MyDBUser] FOR LOGIN [MyDBLogin];EXEC sp_addrolemember ''db_datareader'', ''MyDBUser'''[/code]Enjoy</description><pubDate>Mon, 11 Apr 2011 14:25:05 GMT</pubDate><dc:creator>Ysaias Portes-QUI Group</dc:creator></item><item><title>RE: Script to Add User to all Databases</title><link>http://www.sqlservercentral.com/Forums/Topic1050257-1550-1.aspx</link><description>Is this what you're looking for?[url]http://sqlserverplanet.com/security/add-users-to-database-script/[/url](don't know if it works properly, I just did a quick google search)</description><pubDate>Thu, 20 Jan 2011 05:19:46 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>Script to Add User to all Databases</title><link>http://www.sqlservercentral.com/Forums/Topic1050257-1550-1.aspx</link><description>Hello EveryoneI have lost my script that I use to add a user to all databases.Does anyone have one handy that you could share with me?ThanksAndrew SQLDBA</description><pubDate>Wed, 19 Jan 2011 11:29:33 GMT</pubDate><dc:creator>AndrewSQLDBA</dc:creator></item></channel></rss>