removing old quotes

Aug 13, 2008 1 Replies

how can I remove old quotes that were not been removed after there experation date?


You can use this query - ALWAYS MAKE A BACKUP OF DATABASE. In this query you can change the DayBefore = 30 to the number you want like 60 or 90.

Declare @DayBefore Int Set @DayBefore = 30

Begin Transaction

Update [OrderEntry] Set QuantityOnOrder = 0 Where OrderID In (Select ID From [Order] Where Type = 3 And Closed = 0 And Datediff(Day,[Time],Getdate()) > @DayBefore)

Update [Order] Set Closed = 1 Where ID In (Select ID From [Order] Where Type = 3 And Closed = 0 And Datediff(Day,[Time],Getdate()) > @DayBefore)

Commit Transaction

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required