Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql users

Author  Topic 

naimulah
Starting Member

1 Post

Posted - 2010-04-16 : 12:53:29
Hi All,

I am having a problem when i create a new database. Please see below for the problem.
What I am doing is...
1 - Creating a database (Create Database [mydb];)
2 - Creating a login (CREATE LOGIN [naimulah] WITH =N'naimulah', DEFAULT_DATABASE=[mydb], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF;)
3 - Granting access to the database (CREATE USER [naimulah] FOR LOGIN [naimulah] WITH DEFAULT_SCHEMA=[dbo];)
4 - Making the user db_owner of of that database (EXEC sp_addrolemember 'db_owner', 'naimulah';)

Once I have done these 4 steps, I undo them by
1 - sp_droprolemember
2 - DROP USER
3 - DROP LOGIN
4 - DROP DATABASE.

After all this, I create a new database 'mynewdb' manually using the SQL Server Management Studio. Now after creating 'mynewdb' database what I find is that there is a user named 'naimulah' under the security folder of the database. I don't get it how the sql server has created this user against this database. I can't see any instance of this user anywhere in the Management Studio and in the master..sysusers view.

Please help me out here as how to get rid of this user in the new databases I create. An explanation of why this is happening would be much appreciated.

Thanks in advance
naimulah

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-04-16 : 18:03:17
Is that User defined in the Model system database?

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)
Go to Top of Page
   

- Advertisement -