Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Update datefield to be one minute less than

Author  Topic 

stephena
Starting Member

2 Posts

Posted - 2010-02-09 : 06:45:13
I have a db schema that is:

id | order_ref | order_date |

I have a datetime value contained in my ASP.Net textbox control.

What i would like to do is update the selected record in my database so that the order_date is one minute less than the date held in my control.

Previously i have used "UPDATE tblFixedLine_order_summary SET order_date = DATEADD(mm, 1, DATEDIFF(dd, 0, order_date) - DAY(order_date) + 1) WHERE (fllog_ref = @fllog_ref)" to backdate my orders but i want it only to back date to the specified.

Any help is greatly appreciated.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-02-09 : 07:07:53
Do you mean this?

UPDATE tblFixedLine_order_summary
SET order_date = DATEADD(minute, -1,your_datetime_value_here)
WHERE fllog_ref = @fllog_ref


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -