Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need Help

Author  Topic 

sanlen
Starting Member

29 Posts

Posted - 2008-12-04 : 23:45:55
Hi All,

I have the table as below

create table tbl_test
(id int, user_name varchar(20), acc_name varbinary(50))

And with data inserted as below

insert into tbl_test (id, user_name, acc_name) values (1, 'Name1', EncryptByPassPhrase('abc','002Name1'))

insert into tbl_test (id, user_name, acc_name) values (2, 'Name2', EncryptByPassPhrase('xyz','002Name2'))

I try to show data from that table as below:

select id, user_name, convert (varchar(50),DecryptByPassPhrase('abc', acc_name)) as Account_Name from tbl_test where id=1

I can get the result as i want base on id. However, i want to get the list of all data from the table. Could you please advise how can i show all data?

Thanks you very much for your time and any advise you may give me.




Best Regard,
SANLEN

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-05 : 00:13:24
How would you know what value to pass for the first input parameter of the function?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

karthickbabu
Posting Yak Master

151 Posts

Posted - 2008-12-05 : 00:18:38
You need to check that Encrypt and Decrypt funciton.

====================================================
you realize you've made a mistake, take immediate steps to correct it.
Go to Top of Page

cvraghu
Posting Yak Master

187 Posts

Posted - 2008-12-05 : 02:19:21
Then you should encrypt using same keys for all rows - 'abc'. You shd not use 'xyz' for next row. Right?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-05 : 02:31:23
or store that passphrase along with this tables pk into another table and join onto that while decrypting.
Go to Top of Page

sanlen
Starting Member

29 Posts

Posted - 2008-12-05 : 02:32:33
quote:
Originally posted by cvraghu

Then you should encrypt using same keys for all rows - 'abc'. You shd not use 'xyz' for next row. Right?



Yes, it works fine if i use the same key, but i want to try it with different keys. Could you please advise??

Best Regard,
SANLEN
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-05 : 12:56:45
You still haven't explained to use how to get the different keys. How do you associate a specific key with each row?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -