June 26, 2007 at 1:06 pm
I realize I can adjust the properties of a SQL 2005 Windows Login and assign to the SysAdmin role.
I am in search of T-SQL to allow MyDomain\MyUser login to have SysAdmin on the SQL Server 2005 instance.
June 26, 2007 at 1:16 pm
Try this
USE <dbname>;GRANT CONTROL SERVER TO <username];GO
Read here:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/7e880a5a-3bdc-491f-a167-7a9ed338be7f.htm
I understand now. This will not give you what want.
June 26, 2007 at 2:57 pm
EXEC master..sp_addsrvrolemember @loginame = N'Domain\Username', @rolename = N'sysadmin'
Note that you can find things like this by using the script button that is at the top of many windows such as the Login Properties window.
Bill
June 26, 2007 at 11:57 pm
use master
go
sp_addlogin [domain\username]
sp_addsrvrolemember [domain\username],'sysadmin'
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
December 14, 2010 at 12:07 pm
Sugesh Kumar (6/26/2007)
use master
go
sp_addlogin [domain\username]
sp_addsrvrolemember [domain\username],'sysadmin'
sp_addlogin is for SQL Authentication. You must use sp_grantlogin instead.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply