Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Retrieving Interval Data from Previous Days

Status
Not open for further replies.

evldzl

IS-IT--Management
May 14, 2003
2
US
I currently have a query that runs daily at night to capture interval data from that day.

The syntax I use to capture this data is:

WHERE (RECORD_TYPE = 'INTERVAL')
AND DATE_TIME BETWEEN
CONVERT (varchar(8), GETDATE(),1) + ' 00:00:00' AND
CONVERT (varchar(8), GETDATE(),1) + ' 23:59:00'

The data is stored in the following format:

5/14/2003 7:00:00 AM

My question is - How can I go back to get data that I might have missed from previous days?

The information is from a Melita Predictive dialer and stored in Sybase.

Thanks,

Kevin
 
This isn't the SYBASE forum, it's the MS SQL Server forum.

That said:

getdate() is the current date/time
5/14/2003 7:00:00 AM
getdate()-1 is yesterday's date/time
5/13/2003 7:00:00 AM
getdate()-30 is date/time from 30 days ago
4/14/2003 7:00:00 AM

-SQLBill
 
I know it is the SQL forum, that's why I'm posting the question (as my query is being done in SQL) The database that stores the data that I'm retrieving is Sybase.

I've tried the solution you suggested:

WHERE (RECORD_TYPE = 'INTERVAL')
AND DATE_TIME BETWEEN
CONVERT (varchar(8), GETDATE()-1,1) + ' 00:00:00' AND
CONVERT (varchar(8), GETDATE()-1,1) + ' 23:59:00'

and I get an operand error.

Thanks,

Kevin
 
Kevin,

This is how I get the data for the previous day

tbl.OrderDate >= convert(varchar(10),DATEADD(d,-1,getdate()),101)
AND OrderDate < convert(char(10),getdate(),101)

Will this work for you?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top