Solved

ENCRYPTED FIELD NOT SHOWING UP IN SEARCH

Posted on 2012-03-22
3
453 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 76

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

18 Experts available now in Live!

Get 1:1 Help Now