Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Update Record with a similar funtion to dateadd

Posted on 2006-07-13
1
Medium Priority
?
629 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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

636 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