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 |
pervaiz
Starting Member
3 Posts |
Posted - 2010-11-11 : 02:29:30
|
Hi,I have two strings "New York airport jets 'directed by child' New York's JFK airport. File photo US officials are investigating how a child was apparently allowed to direct planes at New York's JFK airport - one of the country's busiest." and "New York airport jets 'directed by child' New York's JFK airport. File photo US officials are investigating how a child was apparently allowed to direct planes at New York's JFK airport - one of the country's busiest." that are actually retrieved from DB. I have to compare them because it is my project requirement.They seem to be equal and even KDiff(File Comparison Tool)show they are equal. But SQL query shows they are different. Index of difference is 43. I have tried both '!=' and '<>' operators. Any help?Thanks,Pervaiz |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-11-11 : 02:53:38
|
In sql how you are doing comparision ?Are you storing the values in a variable and comparing it ? |
 |
|
pervaiz
Starting Member
3 Posts |
Posted - 2010-11-11 : 03:02:31
|
Thanks for reply.I am storing data in temporary tables and then applying checks. I have to do that because I have to apply some other checks and union the result.Following is my actual query:SELECT #ChildAnswers.QuestionName,#ParentAnswers.BigAnswer AS 'ParentValue',#ChildAnswers.BigAnswer AS 'ChildValue' FROM #ParentAnswers INNER JOIN #ChildAnswers ON #ParentAnswers.QuestionId=#ChildAnswers.QuestionIdWHERE #ParentAnswers.BigAnswer != #ChildAnswers.BigAnswer Please note that I also tried with '<>'. |
 |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-11-11 : 04:02:06
|
quote: Originally posted by pervaiz Thanks for reply.I am storing data in temporary tables and then applying checks. I have to do that because I have to apply some other checks and union the result.Following is my actual query:SELECT #ChildAnswers.QuestionName,#ParentAnswers.BigAnswer AS 'ParentValue',#ChildAnswers.BigAnswer AS 'ChildValue' FROM #ParentAnswers INNER JOIN #ChildAnswers ON #ParentAnswers.QuestionId=#ChildAnswers.QuestionIdWHERE #ParentAnswers.BigAnswer != #ChildAnswers.BigAnswer Please note that I also tried with '<>'.
#ParentAnswers is temp table. Are you creating the structure of temp table initially or creating it in select statement.Can you provide some sample data |
 |
|
pervaiz
Starting Member
3 Posts |
Posted - 2010-11-11 : 04:43:45
|
I am creating temp table in select statement.Select BigAnswer,QuestionName,QuestionId into #ParentAnswers FROM V_ChecklistWHERE ChecklistId =@ParentChecklistSelect BigAnswer,QuestionName,QuestionId into #ChildAnswersFROM V_ChecklistWHERE ChecklistId =@ChildChecklistSELECT #ChildAnswers.QuestionName,#ParentAnswers.BigAnswer AS 'ParentValue',#ChildAnswers.BigAnswer AS 'ChildValue' FROM #ParentAnswers INNER JOIN #ChildAnswers ON #ParentAnswers.QuestionId=#ChildAnswers.QuestionIdWHERE #ParentAnswers.BigAnswer != #ChildAnswers.BigAnswer Following is the data for #ParentAnswersQuestionId QuestionName BigAnswer 12995 PCB Layout Group 1: New York airport jets 'directed by child' New York's JFK airport. File photo US officials are investigating how a child was apparently allowed to direct planes at New York's JFK airport - one of the country's busiest.12996 PCB Layout Group 2: New York airport jets 'directed by child' New York's JFK airport. File photo US officials are investigating how a child was apparently allowed to direct planes at New York's JFK airport - one of the country's busiest.and for #ChildAnswers QuestionId QuestionName BigAnswer12995 PCB Layout Group 1: New York airport jets 'directed by child' New York's JFK airport. File photo US officials are investigating how a child was apparently allowed to direct planes at New York's JFK airport - one of the country's busiest.12996 PCB Layout Group 2: New York airport jets 'directed by child' New York's JFK airport. File photo US officials are investigating how a child was apparently allowed to direct planes at New York's JFK airport - one of the country's busiest.Basically, both tables have same data here. I need to fetch data only if both tables have different BigAnswers. In my case it should return nothing but it treats them as they are different. |
 |
|
|
|
|
|
|