Solved

Update Record with a similar funtion to dateadd

Posted on 2006-07-13
1
596 Views
Last Modified: 2008-02-01
I have a field in my sybase database that holds dates in an interger format. So for example todays date would be 13342 in that field.

I already know how to read that field in a regular date format.

select dateadd(dd, reactivate_date, '1Jan1970') from requests .....

So anything in the reactivate_date column gets returned as a proper date.

I would like to know, how would I take a proper date and convert it back to the number so I can update that particular field using the companies date structure.

Thanks.
0
Comment
Question by:nplib
[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
1 Comment
 
LVL 14

Accepted Solution

by:
Jan_Franek earned 500 total points
ID: 17101284
You need to use datediff function - it is in fact inverse function to dateadd:

for example - this will update reactivate_date with today's date in integer format:

update requests
set reactivate_date = datediff( dd, '1Jan1970', getdate() )
where ...
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
We have put together a white paper that aims to explain how MSPs can both improve their offering and ease the pain of after-hours service by: -Suggesting changes to workflow -Indicating how to rework policy to suit your team -Providing ConnectW…

726 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