Re: Connecting a user from a backup database to a new login



What can I do to work around this? How do I connect a login to an
existing database user? Is there a system table where I can just map
the two?

See the sp_change_users_login stored procedure in the Books Online. Also, the Best Practice is to always schema-qualify objects.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"brad" <brad.eckrose@xxxxxxxxx> wrote in message news:1168719405.103237.233140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
All,

In SQL Server 2000, I loaded a backup file into a new local database.
The database has an existing user which owns several stored procedures,
tables, etc.

Using SQL Server authentication, I want to create a login of the same
name as the user, so that when I login, I have access to the objects
owned by that user without having to prefix the objects with the owner
name.

For instance exec sp_mystoredproc instead of exec
ownername.sp_mystoredproc. (In fact, several of the stored procedures
exec other procedures without the owner name prefix and to go add the
owner will be a tedious process)

When I try to add login and grant the login name to the existing user
it tells me it already exists.

I cannot drop the existing user because it owns a whole bunch of
objects.

What can I do to work around this? How do I connect a login to an
existing database user? Is there a system table where I can just map
the two?

Brad


.



Relevant Pages

  • RE: Creating a DB User *not* on current Machine
    ... the database user is mapped to the SQL login by SID. ... If a matching login does not exist -> create it with a blank password. ...
    (microsoft.public.sqlserver.security)
  • Re: ODBC login problem
    ... CREATE LOGIN MyLogin? ... SQL Server connection". ... database user to the SQL login on the target server. ...
    (microsoft.public.sqlserver.security)
  • Re: SQL Errors creating new db user
    ... Are you trying to map two logins to the same User? ... login gets mapped to a database user. ... login name to the identical database user name (e.g. MyUser login is ... MyUser database user). ...
    (microsoft.public.sqlserver.security)
  • Re: Which User account is used?
    ... Logins are used at server level and Database Users are used at database level. ... If you create a Database User without using FOR LOGIN, then the Database User is mapped to the Login that has the same name with the Database User name. ...
    (microsoft.public.sqlserver.security)
  • Re: How to connect as guest?
    ... You need to look into what a login is and what a database user is. ... guest *user*, but the person still need a login for the SQL Server. ...
    (microsoft.public.sqlserver.programming)

Quantcast