sqlserver2008中遇到一个坑爹的问题,使用以下语句添加的数据

insert into testtable (
username,
password,
productcode
)
select 'testname',
ENCRYPTBYPASSPHRASE(
'test passphrase',
'testpassword'
), 'productcode'

竟然不能用以下查询语句解出

SELECT t.id as id, t.username as username, t.password as password, t.productcode as productcode FROM (
SELECT id, username,
CAST(DECRYPTBYPASSPHRASE( 'test passphrase', password ) as varchar(20))
as password, productcode
FROM testtable
) t
WHERE t.username='testname'

而当使用了nvarchar时却能够成功做到

SELECT t.id as id, t.username as username, t.password as password, t.productcode as productcode FROM (
SELECT id, username,
CAST(DECRYPTBYPASSPHRASE( 'test passphrase', password ) as nvarchar(20))
as password, productcode
FROM testtable
) t
WHERE t.username='testname'

 

相关文章:

  • 2022-02-28
  • 2021-09-12
  • 2022-01-21
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-07
  • 2021-09-27
  • 2022-01-04
  • 2021-12-13
  • 2021-10-01
  • 2021-12-22
  • 2022-12-23
相关资源
相似解决方案