Sep 15, 2010 #1 jtarry IS-IT--Management Mar 10, 2010 22 GB I wish to update a table with an integer showing the difference between two dates. update table set fieldint = date1 - date2 Thanks
I wish to update a table with an integer showing the difference between two dates. update table set fieldint = date1 - date2 Thanks
Sep 15, 2010 #2 bborissov Programmer May 3, 2005 5,167 BG Check DateDiff() function in BOL. BTW Date2 - Date1 is also valid expression. That will give you difference between two datetime fields in days. Borislav Borissov VFP9 SP2, SQL Server 2000,2005 & 2008. Upvote 0 Downvote
Check DateDiff() function in BOL. BTW Date2 - Date1 is also valid expression. That will give you difference between two datetime fields in days. Borislav Borissov VFP9 SP2, SQL Server 2000,2005 & 2008.
Sep 15, 2010 #3 markros Programmer May 21, 2007 3,150 US Boris, Try Code: declare @d date = getdate(), @d2 date set @d2 = GETDATE() - 10 select @d - @d2 Check then http://blogs.lessthandot.com/index....operand-type-clash-date-is-incompatible--2008 PluralSight Learning Library Upvote 0 Downvote
Boris, Try Code: declare @d date = getdate(), @d2 date set @d2 = GETDATE() - 10 select @d - @d2 Check then http://blogs.lessthandot.com/index....operand-type-clash-date-is-incompatible--2008 PluralSight Learning Library
Sep 15, 2010 #4 bborissov Programmer May 3, 2005 5,167 BG Did I said date? I said datetime, isn't it? But BTW I was wrong. Date2 - Date1 = datetime Borislav Borissov VFP9 SP2, SQL Server 2000,2005 & 2008. Upvote 0 Downvote
Did I said date? I said datetime, isn't it? But BTW I was wrong. Date2 - Date1 = datetime Borislav Borissov VFP9 SP2, SQL Server 2000,2005 & 2008.
Sep 15, 2010 Thread starter #5 jtarry IS-IT--Management Mar 10, 2010 22 GB Have have resolved my problem with DateDiff() function by inserting into a varable Thanks Upvote 0 Downvote