Ok...here's the problem, I have a table with a couple of columns, two of which are MonthEnd & TransactionDate
This table loads daily with about 70mil records, MonthEnd is not available, and needs to be calculated from the TransactionDate, whats the quick way of doing this? e.g. If the TransactionDate is '2008/01/24' the MonthEnd dte will be '2008/01/31'. Anyone know how to do this quickly?
Currently I have the code below, but its taking way longer than I'd like.
This table loads daily with about 70mil records, MonthEnd is not available, and needs to be calculated from the TransactionDate, whats the quick way of doing this? e.g. If the TransactionDate is '2008/01/24' the MonthEnd dte will be '2008/01/31'. Anyone know how to do this quickly?
Currently I have the code below, but its taking way longer than I'd like.
UPDATE Transaction.Detail
SET MonthEnd = dateadd(dd, -1 ,dateadd(mm,1+datediff(mm,0,TransactionDate),0))