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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Converting real time dates into SQL unix code type dates

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-25 : 11:47:03
Khuram Ahmad writes "I want to be able to enter a date, convert that date to SQL unix code and compare this date with the stored dates in particular fields within various tables. My result should output charges for a particular month that I specify when entering a start date and end date for a month or other time period. Following is a query I have designed, but it doesn't seem to pull out the correct data. Any suggestions? I am using SQL 7.0 and Windows 2000 Professional.

select distinct a.account_no, substring(a.gl_segment,1,40), b.resource_id, b.amount, b.item_obj_TYPE, substring(c.first_name,1,40),
substring(c.last_name,1,40), c.company, d.cycle_start_t from account_t a, event_bal_impacts_t b,
account_nameinfo_t c, account_products_t d where (b.resource_id = '1000050' or b.resource_id = '1000051')
and a.poid_id0 = b.account_obj_id0 and a.poid_id0 = c.obj_id0 and a.poid_id0 = d.obj_id0
and
d.cycle_start_t > CONVERT(NUMERIC,CONVERT(DATETIME,'20001101')-CONVERT(DATETIME,'19700101'))*86400 and
d.cycle_start_t < CONVERT(NUMERIC,CONVERT(DATETIME,'20001130')-CONVERT(DATETIME,'19700101'))*86400

"
   

- Advertisement -