Avatar of dec789
dec789

asked on 

How to add a new user to a Data base with out going through the "New User" window?

Is there a way to add a user to a SQL server data base without going through the Enterprise Manager's New User window?  Can I some how do this in "code" or a "stored procedure"?  I'm very new with SQL Server as you can probably tell from my question.
Microsoft SQL Server 2005

Avatar of undefined
Last Comment
dec789
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of chapmandew
chapmandew
Flag of United States of America image

hmmm...just noticed that you posted zone 2005, but 2000 as a tag...which one is it?

Also, for best practices, you should use the create user statement if it is 2005, but sp_adduser will work with both.
Avatar of dec789
dec789

ASKER

I'm sorry chapmandew, Where exactly do I enter this code?  In the Query Analyzer?
Avatar of dec789
dec789

ASKER

I'm using SQL Server 2000 but there was no option for that when I submitted the question.  
Avatar of chapmandew
chapmandew
Flag of United States of America image

in a new query editor window in query analyzer....make sure it is in the database context that you want to create the user...you have to already have a login created to map the user to.  logins are associated w/ logins into the instance, users are associated w/ the database.
Avatar of dec789
dec789

ASKER

AngelIII this reference is to SQL Server 2005 Books Online (September 2007).

Do you think it also works with SQL Server 2000?  Which is what I'm using.
Avatar of chapmandew
chapmandew
Flag of United States of America image

Nope, create user is for 2005 only.
no. for sql 2000, you will indeed need the syntax suggested by chapmandev
Avatar of dec789
dec789

ASKER

Thank you so much chapmandew.  sorry the version I'm using is so out ot date the we will be moving to SQL Server 2005 shortly.  The company I work for is slow adapt new technologies.
Microsoft SQL Server 2005
Microsoft SQL Server 2005

Microsoft SQL Server 2005 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. It includes support for managing XML data and allows a database server to be exposed over web services using Tabular Data Stream (TDS) packets encapsulated within SOAP (protocol) requests.

72K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo