Tuesday, April 26, 2005

encryption in sql server 2000

There are functions in SQL server 2000 to encrypt and decrypt passwords, and you can leverage them.

pwdencrypt - encrypts password,
pwdcompare - compares the password and lets you know the result. 0 - false, and 1 - true.

Following script is created as sample insert for Northwind customer table.

INSERT INTO Customers (CustomerID, CompanyName) VALUES ('SAMP', pwdencrypt
('Devel0per'))


DECLARE @myPwd VARCHAR (10)
SELECT @myPwd = CompanyName FROM Customers where Customerid = 'SAMP'
PRINT pwdcompare('Devel0per',@myPwd );

-- prints '1'

 

Pradyut
http://pradyut.tk
http://groups.yahoo.com/group/d_dom/
http://groups-beta.google.com/group/oop_programming
India

 

No comments: