加密
CREATE TABLE Test(MyStr varbinary(max) NOT NULL)GOINSERT Test(MyStr)SELECT EncryptByPassPhrase('A1B2C3E4','世界和平')SELECT MyStr FROM Test/*通常的查询结果:0x01000000CCBC800C6B5CECE3F211FB975C2F8B681CC8301DDE74CF783C6A59316C2BAC08D568151FD573E2FDE01C800805C8D1D5984727DEE95040C1FB604003A3EFDD0444CE72D7E505D1A4*/
解密
SELECT CAST(DecryptByPassPhrase('A1B2C3E4',MyStr) as varchar(max)) FROM Test
/*查询结果:世界和平
*/