All,
Need some help here. I can do this through SSMS, but for some reason can't do it through T-SQL and would rather use T-SQL.
Restored a database to a QC server. I have an orphaned domain login which belongs only to the Prod server. I need to drop this login and add the QC login. I can add the QC login just fine, but can't drop the Prod login without going through SSMS. What am I doing wrong?
It's the last statement that won't work. I've tried it with and without the "MyDomain\" (because the login is listed in the database without the domain name) and I've tried it without the [], but in single quotes both ways. I've even tried sp_revokeLogin. None of them work. I keep getting the following error:
I'm SysAdmin on the server and can drop this orphaned login just fine from SSMS. I just can't seem to code it in T-SQL.
Can someone please advise as to what I'm doing wrong? I'm using SQL Server 2005.
Thanks,
Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
Need some help here. I can do this through SSMS, but for some reason can't do it through T-SQL and would rather use T-SQL.
Restored a database to a QC server. I have an orphaned domain login which belongs only to the Prod server. I need to drop this login and add the QC login. I can add the QC login just fine, but can't drop the Prod login without going through SSMS. What am I doing wrong?
Code:
Drop Schema [MyDomain\ProdLogin]
GO
sp_droprolemember 'db_owner', 'ProdLogin'
GO
Drop Login [MyDomain\ProdLogin]
GO
It's the last statement that won't work. I've tried it with and without the "MyDomain\" (because the login is listed in the database without the domain name) and I've tried it without the [], but in single quotes both ways. I've even tried sp_revokeLogin. None of them work. I keep getting the following error:
error said:Msg 15151, Level 16, State 1, Line 1
Cannot drop the login 'MyDomain\PRODLogin', because it does not exist or you do not have permission.
I'm SysAdmin on the server and can drop this orphaned login just fine from SSMS. I just can't seem to code it in T-SQL.
Can someone please advise as to what I'm doing wrong? I'm using SQL Server 2005.
Thanks,
Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"