Wednesday, March 7, 2012

How to add a Windows User Login to a database using T-SQL

Hi All,

I'm trying to add a new Windows User to a database using T-SQL. I tried the sp_addlogin system proc, but this doesn't allow backslashes (presumably because it only allows creation of SQL Server logins).

I couldn't find a sproc for this, what's the best way to achieve it?

Thanks,

Simon.

Sorry, being stupid - again!!

sp_grantlogin is all you need...

No comments:

Post a Comment