i have a table with field1 as varchar & field2 as varbinary
in field1 whtever data i enter i want to mask it like password field , is it possible directly in SQL
i surfed the net and found post for encryption & decryption as there is no direct password field in SQL
so used the below method
OPEN SYMMETRIC KEY SymmetricKey1 DECRYPTION BY CERTIFICATE Certificate1;
UPDATE tbl1
SET field2 = EncryptByKey (Key_GUID('SymmetricKey1'),field1)FROM tbl1
if there is no direct password field or not ble to mask the field then i need to encrypt the field1
but i am not getting with above
UPDATE tbl1
SET field2 = EncryptByKey (Key_GUID('SymmetricKey1'),field2)FROM tbl1
if i use field2 then only it gets executed