Discussion Locked

SQL 2000 Security - by Transact SQL

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello,

I am writing a script to apply a security strategy in a database and I have two problems:

1) I want to change the blank password of the 'sa' login using:
exec sp_password @loginame = 'sa', @old = '', @new = 'newpwd'

In my computer it works, but in other two it returns:
Old (current) password incorrect for user. The password was not changed.
The password is blank because I use 'sa' and blank to connect in the Query Analyzer to execute the script.

2) I want to drop the 'BUILTIN\Administrator' login using:
IF EXISTS(select * from sysxlogins
where name = 'BUILTIN\Administrators')
BEGIN
exec sp_droplogin @loginame = 'BUILTIN\Administrators'
if @@error <> 0 goto error
END
error:
But it returns:
The login 'BUILTIN\Administrators' does not exist.

This login exists because 'select' returns:
srvid sid xstatus xdate1 xdate2 name password dbid language isrpcinmap ishqoutmap selfoutmap
------ -------------------------------------- ------- --------------------------- -------------------------- -------------------------- ------------- ------ ---------- --- --- ----
NULL 0x01020000000000052000000020020000 22 2002-09-16 12:06:27.743 2002-09-16 12:06:28.317 BUILTIN\Administrators NULL 1 us_english 0 0 0

(1 row(s) affected)

Does anybody know what could be the problem?
Thank you in advance,
Sofia

1 reply

by saa_786

I tested what you were trying to do. sp_password is successfully excuting from any other computer through Query Analyzer. But Droping of login fails , even it does not delete through delete statement.

This discussion is closed to new replies.