This topic is locked

Return rows equal to current date

7/21/2009 5:00:31 PM
ASPRunnerPro General questions
author

Hello everyone,
I am using ASPRunner 6.1 Build2503. My query is against a MS SQL DB. I have built a listing that displays data and one of the fields is a date. I does everything I need it to do except one item.
In the Listing it displays all of the fields I need from the DB but I wish to limit what to display to the current date. The field I need to validate against the current date is "CALL_CREATED_DATE".
I have tried the filter in the Query Designer of "=GETDATE()" and other veriations of the MS SQL GETDATE item. When I apply the filter, it displays, in the "Results", no data at all. If I remove the filter, it displays all data. According to the SQL commands in w3schools.com it should work.
How do I display only data that is from the current date of the server or workstation? What I want to see are rows where the "CALL_CREATED_DATE" is = to the current date. Any assistance would be appreciated.

Thank you,

Joe

J
Jane 7/22/2009

Joe,
GETDATE() function returns current date and time.

I suppose you need to compare date, not date and time in your SQL query.

Check this article:

http://www.w3schools.com/SQl/func_convert.asp

1312 7/22/2009

Joe,

GETDATE() function returns current date and time.

I suppose you need to compare date, not date and time in your SQL query.

Check this article:

http://www.w3schools.com/SQl/func_convert.asp


So your saying I need to convert the date first using the Convert function then compare it to the GETDATE function in Query Designer?
This is the table
2009-04-28 00:00:00.000

2009-07-18 00:00:00.000

2009-07-18 00:00:00.000

2009-07-18 00:00:00.000

2009-07-18 00:00:00.000
I want ASPRunner to list only lines that are from today's date. In the table, I want to display data from the last four lines but not the first line.

Joe

J
Jane 7/23/2009

Hi,
here is a sample:> where datediff(day,CALL_CREATED_DATE,GETDATE())=0

1312 7/28/2009

Hi,

here is a sample:


Jane, When I add this to the SQL statement, it shows no records found although there are several. Any suggestions?

Thanks

Joe

1312 7/28/2009



Jane, When I add this to the SQL statement, it shows no records found although there are several. Any suggestions?

Thanks

Joe



This is what I am using:
SELECT

SERVICE,

CALL_NO,

PRIORITY,

PRIMARY_UNIT,

LOCATION_ADDRESS,

APARTMENT,

LOCATION_INFO,

BEAT_OR_STATION,

CALL_CLOSE_TIME,

CALL_TYPE_FINAL_D,

CALL_CREATED_DATE,

CALL_CREATED_TIME,

CALLKEY,

CAD_CALLKEY

FROM dbo.CarsCall

WHERE CALL_CLOSE_TIME IS NULL and datediff(day,CALL_CREATED_DATE,GETDATE())=0

ORDER BY PRIORITY, BEAT_OR_STATION

J
Jane 7/29/2009

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

C
clig 8/4/2009



This is what I am using:
SELECT

SERVICE,

CALL_NO,

PRIORITY,

PRIMARY_UNIT,

LOCATION_ADDRESS,

APARTMENT,

LOCATION_INFO,

BEAT_OR_STATION,

CALL_CLOSE_TIME,

CALL_TYPE_FINAL_D,

CALL_CREATED_DATE,

CALL_CREATED_TIME,

CALLKEY,

CAD_CALLKEY

FROM dbo.CarsCall

WHERE CALL_CLOSE_TIME IS NULL and datediff(day,CALL_CREATED_DATE,GETDATE())=0

ORDER BY PRIORITY, BEAT_OR_STATION


check for blank (empty) as well as NULL?
(DATEDIFF(day, CALL_CREATED_DATE, GETDATE()) = 0) AND (CALL_CLOSE_TIME IS NULL) OR (DATEDIFF(day, CALL_CREATED_DATE, GETDATE()) = 0) AND (CALL_CLOSE_TIME = '')

  • or another value or do these fields show as "Null" in SQL Server Management Studio / Enterprise Manager?