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 |
enzo_p
Starting Member
7 Posts |
Posted - 2008-11-03 : 06:40:52
|
Hi,I have 2 date parameters fed to my report which i want to use to count the number of records between.I have the SQL set up to do this ok and it brings back the expected number of records - EXCEPT for when the "from" date and the "to" date cross a month boundary.i.e. from 25/10/2008 to 31/10/2008 works fine, however 25/10/2008 to 03/11/2008 brings back no records.I should say at this point that the date column that i am basing this 'between' comparison on is already converted to varchar 103 - could this be causing the problem?Thanks in advance for any help |
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2008-11-03 : 07:03:45
|
If the column is varchar then your BETWEEN filter will sort alphabetically. And since 25 is larger than 03 you will not get any results. Do you filtering when the column is still in DATETIME format or convert using 112 or 102 or something.- Lumbago |
|
|
enzo_p
Starting Member
7 Posts |
Posted - 2008-11-03 : 07:09:30
|
thanks makes sense! thanks :) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-03 : 09:23:01
|
Its always better to do the date formatting in your reports. you should always bring date fields in native format itself to reports.you've date formatting function available in reports itself for formatting the date values. |
|
|
|
|
|