?
Solved

add/sub value of 2 columns and get difference

Posted on 2005-04-27
2
Medium Priority
?
244 Views
Last Modified: 2010-05-18
Ok, I have it down, on how to perform my update for dates, based on column values:

        UPDATE TL_Calibration SET [Next Calib] = DATEADD(day, InspectionFrequency, [Last Calibrated])

The question I have now is how to take two columns, with date values, and insert the difference into a column.  Here is an example of what I am talking about:

[Last Calibrated]        [Next Calib]    =     Days
-----------------------------------------------------------
    04/01/05                04/05/05                4       <------WHERE "4" IS HOW MANY DAYS LEFT      
0
Comment
Question by:chrisryhal
2 Comments
 
LVL 28

Accepted Solution

by:
rafrancisco earned 2000 total points
ID: 13877225
UPDATE YourTable
SET DaysLeft = DATEDIFF(DD, [Last Calibrated], [Next Calib])
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 13877315
Thanks,
CR
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

840 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