Solved

ENCRYPTED FIELD NOT SHOWING UP IN SEARCH

Posted on 2012-03-22
3
455 Views
Last Modified: 2012-03-28
I have a table with a few encrypted fields using a Encryption function. This has worked for years (since 2006) but today I did a search using the encrypt function

eg select * from table1 where encrypted_field = dbo.data_encrypt('1111111111111111')
but it brings back no results but if I do
select dbo.data_encrypt('1111111111111111')
which returns XYXRE!dr257itcsWEE
and then search
select * from table1 where encrypted_field = XYXRE!dr257itcsWEE
it brings back over 400 records.
We have recently changed from SQL2005 to SQL 2008. other than that I can't think of anything else. It also seems that the records are all from before we did the changeover
0
Comment
Question by:Niall292
  • 2
3 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 37755176
What is the data type for the column?
Try using cast to enclosed the encrypt function to make sure that the data types match.
0
 

Accepted Solution

by:
Niall292 earned 0 total points
ID: 37756693
We finally found the problem for some reason when we moved to SQL 2008 the encrytion was putting a line feed after the encryption, I can't explain why and don't know if this is a bug or not but that was my issue and maybe it might give somebody some help if they have the same problem.
0
 

Author Closing Comment

by:Niall292
ID: 37775642
We found the solution after playing with the function.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Contained Database Collations 6 27
SQL Help - 12 59
Sql user function 7 31
How to write a sql query returning a result  with my date time template? 8 26
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now