SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Where to create the login and user account


Where to create the login and user account

Author
Message
river1
river1
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1778 Visits: 1366
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
Perry Whittle
Perry Whittle
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20152 Visits: 17244
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" ;-)
river1
river1
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1778 Visits: 1366
Thank you very much Perry
Perry Whittle
Perry Whittle
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20152 Visits: 17244
No problem, glad i could help!

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

"Ya can't make an omelette without breaking just a few eggs" ;-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search