Solved

Update Record with a similar funtion to dateadd

Posted on 2006-07-13
1
585 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Sybase - Convert Rows to Columns 10 490
MS SQL Linked server 3 135
sql anywhere query 5 143
sybase 3 48
ConnectWise and their customers need to ensure critical alerts automatically reach the right person at the right time. MSP superheros efficiently respond to these alerts key is providing automatic, intelligent alerting that generates a complete audi…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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