RE: Stored Procedure Question regarding users
From: John E Davis (JohnEDavis_at_discussions.microsoft.com)
Date: 01/04/05
- Next message: Hugo Kornelis: "Re: Database option "autoclose" is set. Why?"
- Previous message: Scott Morris: "Re: help on SQL UPDATE needed"
- In reply to: AUttendorf: "RE: Stored Procedure Question regarding users"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 4 Jan 2005 14:23:01 -0800
thanks for the additional pointer.
This forum is awesome.
"AUttendorf" wrote:
>
> You can run the procedure as is substituting Pubs with your database name.
> If this does not create the login for you (which it should), you can create
> the login manually and use the update_one option. The syntax would then read:
> USE <yourdbnamehere>
> GO
> EXECUTE sp_change_users_login 'update_one', loginname, loginname
>
> "John E Davis" wrote:
>
> > I have found the following instruction set for fixing an existing user that
> > was restored to a new SQL server. I understand that the database being
> > restored maintains the users that were associated to it when the database was
> > backed.
> >
> > Now that I am restoring the database to a new SQL server instance (with the
> > same server name) I should be able to run the below command to create the SQL
> > logins for the users who already exist in the database that I am restoring,
> > correct?
> >
> > Anyways, I am fairly new to running SQL Stored Procedures and would like to
> > know information regarding this command.
> >
> > First: I see the entry for "USE pubs" preceeding the "EXEC" I am assuming I
> > would put the name of the database that I just restored here since my users
> > are located in that database...correct?
> >
> > Second: The new SQL server does not have the users created for SQL logins on
> > the system therefore, according to this command I should be able to create
> > the users during this Stored Procedure...correct?
> >
> > Let me know if I am off in the manner in which to run this.
> >
> > Thanks,
> >
> > C. Automatically map a user to a login, creating a new login if necessary
> > This example shows how to use the Auto_Fix option to map an existing user to
> > a login with the same name, or create the SQL Server login Mary with the
> > password B3r12-36 if the login Mary does not exist.
> >
> > USE pubs
> > go
> > EXEC sp_change_users_login 'Auto_Fix', 'Mary', NULL, 'B3r12-36'
> > go
> >
> >
- Next message: Hugo Kornelis: "Re: Database option "autoclose" is set. Why?"
- Previous message: Scott Morris: "Re: help on SQL UPDATE needed"
- In reply to: AUttendorf: "RE: Stored Procedure Question regarding users"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|