Solved

SQL weird

Posted on 2006-11-22
10
161 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
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 142

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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 142

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

10 Experts available now in Live!

Get 1:1 Help Now