Thursday, March 8, 2012

Create new login non case sensitive

I am trying to create a new login on a database, and I want that username and password NOT to be case sensitive. Do I have to set this at the server level or can I set this in the SQL script?

Here is the script I am currently using...

IF EXISTS (SELECT * FROM dbo.sysusers WHERE [name] = 'UName')

BEGIN

EXEC sp_dropuser 'UserName'

EXEC sp_droplogin 'UserName'

END

EXEC sp_addlogin 'UserName', 'Password', 'Database'

GO

EXEC sp_adduser 'UserName', 'Password', 'db_datareader'

GO

Any help would be appreciated...

David

SQL Server 2005 only uses case sensitive password, this is an intentional behavior change for SQL Server 2005.See http://msdn2.microsoft.com/en-us/library/ms143359.aspx for more details.

Thanks,

-Raul Garcia

SDE/T

SQL Server Engine

|||

Also, the sp_adduser statement is incorrect - there is no password for users; the second parameter of sp_adduser is the user's name in the database. See http://msdn2.microsoft.com/en-us/library/ms181422.aspx for more information on sp_adduser.

Thanks
Laurentiu

No comments:

Post a Comment