Solved

SQL weird

Posted on 2006-11-22
10
165 Views
Last Modified: 2010-04-30
SELECT DISTINCT fldHistoSItemsDate, fldHistoSItemsHeure, fldHistoSItemsEmp
FROM         [Histo - SItems]
WHERE     (fldHistoSItemsSaisie = 144)
ORDER BY fldHistoSItemsDate, fldHistoSItemsHeure



This request returns me 4 result in VB6 but 1300 in SQL Manager... any idea ? not the same format but same value.
0
Comment
Question by:TheSonics
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 168 total points
ID: 17999997
In vb I would get it to output the exact query that is being run, then copy that to sql manager and try it.

You may need to address the specific database, also the distinct keyword may be causing you problems.  It should however be behaving the same if the exact same query is sent to it.
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 166 total points
ID: 18001083
can you show us the relevant VB code?
what is the table structure?


like Raynard indicates, the issue might the distinct with the datetime fields, which due to different formatting, might do different results.
you might then have to apply the convert() function around them to force the same output, like:

SELECT DISTINCT convert(varchar(10), fldHistoSItemsDate, 120) as fldHistoSItemsDate#
, convert(varchar(10), fldHistoSItemsHeure, 8) as fldHistoSItemsHeure , fldHistoSItemsEmp
FROM         [Histo - SItems]
WHERE     (fldHistoSItemsSaisie = 144)
ORDER BY 1, 2
0
 
LVL 9

Assisted Solution

by:Naveen Swamy
Naveen Swamy earned 166 total points
ID: 18001309
angelIII  is right,
 also use trace/profiler to check for any errors,
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 17

Expert Comment

by:inthedark
ID: 18006818
What is the data type of fldHistoSItemsSaisie?
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 18074691
I think that you should ask to have your grade re-marked, if none of these solutions gave you your answer then you should have indicated as such - C's should only rarely / if ever be given - read the help files if you are unsure

Additionally since navstar's answer was just agreeing with AngelIII's answer he should be given some of the credit.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18372701
point split Raynard, angelIII, navstar16
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

737 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