January 25, 2006 at 11:43 am
Hello All, I've got a script that will Create a Database and install the tables onto a SQL server.
what code is used to add a user/username and password to allow the user to login?
I am aware that I can do this from the SQL Server, However, I've been asked to do it in the code.
I'm pretty sure this uses CREATE_USER however I can't get it to work.
Please help
TIA
Woody
January 25, 2006 at 11:51 am
sp_grantdbaccess grants access to a database
Use sp_grantlogin to reverse the effects of a previous sp_denylogin that has been executed for a Windows NT user.
Use sp_addlogin to allow a SQL Server login to connect to SQL Server.
Although a login can connect to SQL Server after sp_grantlogin has been executed, access to user databases is denied until a user account for the login is created in each database that the login must access. Use sp_grantdbaccess to create a user account in each user database.
sp_grantlogin cannot be executed within a user-defined transaction.
Only members of the sysadmin or securityadmin fixed server roles can execute sp_grantlogin.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply