Hi,
SELECT UserID, UserName, Password, PublisherID, Currency
FROM [User]
WHERE (Password = 'Anitha') I am using the above mentioned it is working but int the password field i had given it as anitha. Now the querry is retriving the record for anitha, it shouldnot happen. The querry should retrive the record of anitha only for where condition anitha and not for Anitha or ANITHA etc..
Thanks
Vishwanath
Convert the password field and password value to varbinary and compare if they are equal.
Here is the code:
select
*from userswhere UserName='Nilesh'Andcast(passwordasvarbinary(20))=cast(N'password'asvarbinary(20))The usename is not case sensitive but password is.
|||hi Vishwanath,
its good practise to store passwords in encoded/encrypted format. what i do is use a custom encryption function which uses our own logic to encrypt each character and store it.
to add what Nilesh has mentioned read this linkhttp://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm
Hope it helps.
regards,
Satish.
|||Hi satish,
now its working fine, but when i choose the collation property from that password field and changed it to bin format then at that it gave some warning message saying that some of the data will be lost, but when i choose yes i couldnt experience any such loss of data. Everything is working fine..
Thnaks
Vishwanath
|||ohk sounds cool.
please mark the post which helped you as answered, it will give credit to answerer and post will be resolved.
thanks,
satish.
No comments:
Post a Comment