Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create user problem?

Status
Not open for further replies.

baran121

Programmer
Sep 8, 2005
337
TR
hi i want to create user. i can create user in sql 2000 with below code. but sql 2005 express there are errors.

declare @p_user varchar(20)

set @p_user='ARGECMAS'

exec sp_addlogin @p_user,@p_user,'zynp_kerimler','English'
exec sp_adduser @p_user,@p_user
exec sp_addsrvrolemember @p_user, 'securityadmin'
exec sp_grantdbaccess @p_user

the errors:
Msg 15118, Level 16, State 1, Line 1
Password validation failed. The password does not meet Windows policy requirements because it is not complex enough.
Msg 15007, Level 16, State 1, Procedure sp_adduser, Line 15
'ARGECMAS' is not a valid login or you do not have permission.
Msg 15007, Level 16, State 1, Procedure sp_addsrvrolemember, Line 68
'ARGECMAS' is not a valid login or you do not have permission.
Msg 15007, Level 16, State 1, Line 1
'ARGECMAS' is not a valid login or you do not have permission.


please help me.
 
Are the sql 2000 and sql Express 2005 on the same Windows machine?
 
Code:
The password does not meet Windows policy requirements because it is not complex enough
You need a more complex password.
 
thank you yelworcm. i changed my code and it worked. but there is still an error. the code is below.

declare @p_user varchar(20)
declare @p_pass varchar(20)

set @p_user='ARGEE'
set @p_pass='arge122105'

--exec sp_addlogin @p_user,@p_pass,'zynp_kerimler','English'

--exec sp_adduser @p_user,@p_user
--exec sp_addsrvrolemember @p_user, 'securityadmin'
exec sp_grantdbaccess @p_user

the error is that:
User, group, or role 'ARGEE' already exists in the current database.

why is this error?


 
The name ARGEE already exists in this database as either a user, or a role. Probably from one of your earlier tests.
 
i used new users. but i got same error.

declare @p_user varchar(20)
declare @p_pass varchar(20)

set @p_user='ARGEEEEE'
set @p_pass='arge122105'

exec sp_addlogin @p_user,@p_pass,'zynp_kerimler','English'
exec sp_adduser @p_user,@p_user
exec sp_addsrvrolemember @p_user, 'securityadmin'
exec sp_grantdbaccess @p_user

 
If you get the same error, the user is not new.
Code:
select name
from sys.database_principals
or
Code:
sp_helpuser
 
Code:
exec sp_grantdbaccess @p_user
This line is redundant. This procedure is used to give a windows login access to the database. By the way, why are you not using the CREATE USER and CREATE LOGIN statements?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top