Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Where to create the login and user account Expand / Collapse
Author
Message
Posted Wednesday, March 24, 2010 10:39 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 15, 2016 5:58 AM
Points: 908, Visits: 1,290
I need to create a login and a user account in several databases using t-sql
I need to know where (in wich database) to create the login and the user account.


If i have a login like:

CREATE LOGIN test WITH PASSWORD='test'

Do i have to create this having the query window in the master database? or can the query window be connected to other database (e.g a user database).

What about the account:

USER test FOR LOGIN test WITH Default_schema=dbo


Should the query window of MS be connected to the master database or to the user database?

Thank you







Post #889125
Posted Wednesday, March 24, 2010 12:06 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 4:31 AM
Points: 8,189, Visits: 16,353
river1 (3/24/2010)
I need to create a login and a user account in several databases using t-sql
I need to know where (in wich database) to create the login and the user account.


If i have a login like:

CREATE LOGIN test WITH PASSWORD='test'

Do i have to create this having the query window in the master database? or can the query window be connected to other database (e.g a user database).

What about the account:

USER test FOR LOGIN test WITH Default_schema=dbo


Should the query window of MS be connected to the master database or to the user database?

Thank you


doesnt matter for the create login as they are always created in master anyway. For the Create user you need to specify a USE for the database you want the user created in


-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #889224
Posted Thursday, March 25, 2010 2:27 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 15, 2016 5:58 AM
Points: 908, Visits: 1,290
Thank you very much Perry
Post #889601
Posted Thursday, March 25, 2010 7:16 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 4:31 AM
Points: 8,189, Visits: 16,353
No problem, glad i could help!

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #889783
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse