General discussion
February 19, 2003 at 11:13 PM
sofia

SQL 2000 Security – by Transact SQL

by sofia . Updated 23 years, 5 months ago

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

This discussion is locked

All Comments