July 15, 2008 at 4:11 am
I have created a a DB using sql commands. and when i opened the user mappings the db_Owner check box is not checked in .. how can I check that option while creating the DB using scripts? or while creating the user by script (sql commands).. Please help me out
July 15, 2008 at 4:40 am
EXEC sp_defaultdb <Login Name>, <Database Name>
Run it after both the login and the database exist
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 15, 2008 at 4:59 am
I have tried this sp_defaultdb lsr, temp... but in user mappings only the public check box is showing as checked...
July 15, 2008 at 5:02 am
The proc doesn't assign rights to the DB. It just makes it the login's default database. You'll have to grant any rights you want the login to have.
After running that, if you check the General tabl of the login, you should see the default DB set.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 16, 2008 at 5:35 pm
If you already have the login created and are adding another db, you can use the proc below to make the user a member of db_owner:
EXEC sp_grantdbaccess ' '
GO
EXEC sp_addrolemember 'db_owner', ' '
GO
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply