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.
| Author |
Topic |
|
jackstow
Posting Yak Master
160 Posts |
Posted - 2001-09-27 : 10:36:55
|
| OK so I have a trigger for inserts that takes the data from the INSERTED table and places it in another using the encrypt() function along the way. CREATE TRIGGER insert_encryptedON testFOR INSERTAS DECLARE @count intSELECT @count = COUNT(*) FROM INSERTED IF @count > 0BEGININSERT INTO encrypted_test (test_id, cart_id, user_id)SELECTencrypt(INSERTED.test_id),encrypt(INSERTED.cart_id),encrypt(INSERTED.user_id)FROM INSERTEDEND..where test_id is PK in both tables. This works fine for a while but every now and then the encrypted numbers get mixed up and are placed in the wrong columns (!?) and the primary key constraint is broken and it all goes horribly wrong. If the encrypt is taken off the encrypted_test.test_id column it works fine. Is this something to do with using encrypt on a primary key..? |
|
|
|
|
|