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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Problem with encryptbykey key_guid

Author  Topic 

BukHix
Starting Member

2 Posts

Posted - 2007-09-06 : 15:55:18
Today is the first time I have tried working with encrypting fields in SQL server. So far I have created, opened and tested a symmetric key named symInventory (Select * from sys.openkeys - to verify).

Now I am trying to Fill a table with encrypted passwords where plain text passwords exist now. With the statement below I am getting this error:

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '('.


INSERT INTO Inventory.dbo.tblUsers(
UserName,
LoginID,
encryptbykey(key_guid('symInventory'), LoginPW, 1, LoginID))
SELECT
tblPtUser.UserName,
tblPtUser.LoginID,
tblPtUser.PW
FROM


What am I doing wrong?

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-09-06 : 15:58:49
shouldn't that be a field name?


INSERT INTO Inventory.dbo.tblUsers(
UserName,
LoginID,
encryptbykey(key_guid('symInventory'), LoginPW, 1, LoginID))
SELECT
tblPtUser.UserName,
tblPtUser.LoginID,
tblPtUser.PW
FROM



--------------------
keeping it simple...
Go to Top of Page

BukHix
Starting Member

2 Posts

Posted - 2007-09-06 : 16:12:13
Shouldn't what be a field name? I am completely lost and have only got as far as I have with this sample Encrypt and decrypt data in SQL Server 2005.

Go to Top of Page
   

- Advertisement -