Re: New User error...

From: Dan Guzman (danguzman_at_nospam-earthlink.net)
Date: 03/25/04


Date: Wed, 24 Mar 2004 22:37:45 -0600

Before you add a user to a database, you need to first add the login. For
example:

--SQL authentication
EXEC sp_addlogin 'MyLogin', 'Mypassword'
USE MyDatabase
EXEC sp_adduser 'MyLogin'

--Windows authentication
EXEC sp_grantlogin 'MyDomain\Mylogin'
USE MyDatabase
EXEC sp_grantdbaccess 'MyDomain\Mylogin'

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"Chris Marsh" <cmarsh@synergy-intl.com> wrote in message
news:%2345isUhEEHA.3872@tk2msftngp13.phx.gbl...
> I am getting error 15007 when trying to create a new user. Why?  This is a
> silly error, I know the user doesn't because I am trying to add them but
> this is the error I get when trying to add any user to the database.  What
> the heck am I doing wrong?
>
> Thanks in advance!
>
> Chris
>
>


Relevant Pages

  • Use a Trusted Connection With OPENROWSET?
    ... The first two queries below used to work ... just fine because they use SQL authentication. ... Can a trusted connection be used with OPENROWSET? ... EXEC master..sp_who2') AS a ...
    (microsoft.public.sqlserver.connect)
  • Re: permissions for Desktop engine
    ... > with the OSQL utility or any ad-hoc SQL application. ... > EXEC sp_defaultdb 'MyLogin', 'MyDatabase' ... > GRANT ALL ON MyTable TO MyRole ...
    (microsoft.public.sqlserver.security)
  • Re: permissions for Desktop engine
    ... with the OSQL utility or any ad-hoc SQL application. ... EXEC sp_defaultdb 'MyLogin', 'MyDatabase' ... GRANT ALL ON MyTable TO MyRole ...
    (microsoft.public.sqlserver.security)
  • Re: Cant login to SQL Server
    ... exec sp_addlogin 'USERA', 'xxxxx', 'MyDatabase' ... exec sp_addlogin 'USERB', 'xxxxxx', 'MyDatabase' ... EXEC sp_grantdbaccess 'USERB' ...
    (microsoft.public.sqlserver.security)
  • Re: Find out which table columns are included
    ... I usually enable fulltext indexing on a table with the following ... USE MyDatabase ... EXEC sp_fulltext_catalog 'MyTable_Fulltext', 'create' ...
    (microsoft.public.sqlserver.fulltext)