Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Setup User with Admin Access to 40 Databases

Author  Topic 

bconner
Starting Member

48 Posts

Posted - 2010-05-03 : 08:21:35
I have roughly 40 databases on SQL Server 2008 Express. I need to set a User up with Login and Admin rights can this be done using a script? I want to use the User's windows login and password. Any help is greatly appreciated..

Brian

RobertKaucher
Posting Yak Master

169 Posts

Posted - 2010-05-03 : 11:54:34
If this user needs to be an administrator, then do it this way:

USE [master]
go

CREATE LOGIN [domain\username] FROM WINDOWS
GO
EXEC sp_addsrvrolemember @loginame = N'domain\username', @rolename = N'sysadmin'


EDIT: You should check these pages for the documentation on the commands:
http://msdn.microsoft.com/en-us/library/ms189751.aspx
http://msdn.microsoft.com/en-us/library/ms186320.aspx

===
http://www.ElementalSQL.com/
Go to Top of Page
   

- Advertisement -