How to compare datetime in SQL to Remedy/Unix datetime?

I'm writing a DTS package which queries a Remedy database. Datetime in Remedy is handled as seconds since 1 January 1970. My question is, how do I compare SQL datetime to Remedy datetime?

SELECT * FROM RemedyTable WHERE getdate() >= [datefield]

I tried to convert the getdate() into seconds using DATEDIFF, but I don't think this can run on Remedy.

Any ideas?
TimHayesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

adatheladCommented:
The query I'd use would be:
SELECT * FROM RemedyTable WHERE DateField <= DATEDIFF(ss, '1970-01-01 00:00:00', GETDATE())

If you're saying that doesn't work, try this (I cant see why it wouldnt work - this next example is practically the same really).

DECLARE @pdecConvertedTime DECIMAL(18,0)
SELECT @pdecConvertedTime = DATEDIFF(ss, '1970-01-01 00:00:00', GETDATE())

SELECT * FROM RemedyTable
WHERE DateField <= @pdecConvertedTime


Cheers
0
TimHayesAuthor Commented:
This doesn't seem to work, because I'm writing a DTS package it needs to run in the Remedy/Oracle environment rather than the SQL Server environment. So, whilst SQL Server parses the query correctly, it won't run correctly in Remedy.

Any other ideas?
0
adatheladCommented:
ah ok, I'm unfamiliar with the Remedy/Oracle environment so I don't know the query syntax.

What I was trying to suggest, is that you format the current date/time in the DTS package in SQL into seconds since Jan 1 1970, before passing that value into the query on the Remedy database. i.e. as opposed to performing the date manipulation inside the actual query which fails.

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

TimHayesAuthor Commented:
That's definitely the way to do it, but because I'm writing a DTS package all the declarations and formatting of variables is done in the same part as the SQL query itself.

Unless you know of a way to pass a variable to a DTS package...?
0
adatheladCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TimHayesAuthor Commented:
That's definitely the way to do it, but because I'm writing a DTS package all the declarations and formatting of variables is done in the same part as the SQL query itself.

Unless you know of a way to pass a variable to a DTS package...?
0
CleanupPingCommented:
TimHayes:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.