Hi,
I'm attaching a new database programatically using VB.net application. I wrote DB scripts and execute them using command object. After attaching the db, I have to create logins and add roles. If the login am going to create is already existing on that target SQL server then am just adding the roles using (EXEC SP_addrolemember), problem starts here. Role gets added to the User but it only shows in the db that I have just now attached. ie-
In management studio -> Databases -> ((newly attached database)) -> Security -> Users
but its not added in the main SQL server, ie -
In management studio -> Security -> Logins -> ((user name))
When I double click the username in the main sql server logins under "User Mappings", I dont find the roles appended. Its updated only under the database I have attached. Due to this when I try to open the newly attached database using the existing user credentials then it says access denied to the newly attached database!!
Is there any way around this problem??
Thanks in advance
Sai