?
Solved

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

Posted on 2003-02-25
7
Medium Priority
?
1,666 Views
Last Modified: 2008-01-09
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?
0
Comment
Question by:TimHayes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 23

Expert Comment

by:adathelad
ID: 8017413
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
 

Author Comment

by:TimHayes
ID: 8017566
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
 
LVL 23

Expert Comment

by:adathelad
ID: 8017626
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:TimHayes
ID: 8017747
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
 
LVL 23

Accepted Solution

by:
adathelad earned 400 total points
ID: 8017766
0
 

Author Comment

by:TimHayes
ID: 8017819
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
 

Expert Comment

by:CleanupPing
ID: 9276352
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

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question