Unfortunatly I need to figure out how to delete a login from a SQL Script.
"JT Lovell" <jt_lovell@yahoo.com> wrote in message
news:u$7xeIP%23DHA.2644@TK2MSFTNGP11.phx.gbl...
>I think you're seeing a problem I get a lot. Here's what my problem is and
> the solution I use, perhaps it will help you.
>
> I get a problem similar to this when I backup and restore a database under
> a
> different name. I end up with 2 databases thinking they have a user X,
> but
> the SQL server only thinks user X has access to the one database. To fix
> this, I end up having to delete the user from SQL server and in the second
> database, and then recreate it and give access to both databases.
>
> Here's the process (SQL Server 2000):
>
> 1. In Enterprise Manager, right-click the SQL server and select
> properties.
> 2. On the Server Settings tab, check the box under Server behavior that
> says, "Allow modifications to be made directly to the system catalogs."
> 3. Click OK to exit SQL Server Properties.
> 4. Delete the user from the SQL Server by removing from
> [ServerName]>Security>Logins
> 5. Verify that each database no longer shows that user under
> [ServerName]>Databases>[DatabaseName]>Users
> 6. If the user still shows up, try to remove via the GUI. If it gives an
> error continue on to #7
> 7. Open [ServerName]>Databases>[DatabaseName]>Tables and right-click the
> "sysusers" table. Select Open Table>Return all rows
> 8. Find the row with the matching "name" to the user you are trying to
> delete, and delete it.
> 9. Try to recreate the user normally.
>
> I'm sure you can do this via SQL scripts as well, but I generally do this
> in
> the GUI.
>
> --
> JT Lovell
>
> "Marco Napoli" <marco@avantitecnospam.com> wrote in message
> news:u9TtFRN%23DHA.1636@TK2MSFTNGP12.phx.gbl...
>> I am trying to delete a user from SQL Server which as access to 2
> different
>> database in the same SQL Server.
>> What is the correct way of Deleting an SQL Server login?
>> The below runs, but when I try to recreate another user with the name c
>> it
>> says its already created? I am sure I am not doing the Delete SQL Server
>> commands....
>>
>> use DB1
>> exec sp_dropuser 'c'
>> use DB2
>> exec sp_dropuser 'c'
>> use DB1
>> exec sp_droplogin 'c'
>> use DB2
>> exec sp_droplogin 'c'
>>
>> Thanks
>> Peace in Christ
>> Marco Napoli
>>
http://www.ourlovingmother.org >>
>>
>
>