sql server - How to bulk update the date column -
i have table 10000 records.
sample
id transaction_id contract_id contractor_id servicedetail_id servicemonth unitsdelivered createdate ---------------------------------------------------------------------------------------------------------------------------- 1 1 352 466 590 2016-03-01 203 2016-04-25 17:01:55.000 2 1 352 466 566 2016-03-01 200 2016-04-25 17:02:38.807 3 1 352 466 138 2016-04-13 20 2016-04-13 00:00:00.000 5 1 352 466 138 2016-04-14 21 2016-04-13 00:00:00.000 6 10011 40 460 68 2016-03-17 10 2016-04-25 17:20:13.413 7 10011 40 460 511 2016-03-17 15 2016-04-25 17:20:13.413 8 10011 40 460 1611 2016-03-17 20 2016-04-25 17:20:13.413 9 20011 352 466 2563 2016-02-05 10 2016-04-25 17:20:25.307 11 100 40 460 68 2016-03-17 10 2016-04-25 17:29:23.653
in table have servicemonth
different dates.
i want update servicemonth
column existing months last date.
- suppose if have 2016-03-17 in table, should updated 2016-3-31
- suppose if have 2016-05-12 in table, should updated 2016-5-31
can suggest single query update this?
eomonth
: returns last day of month contains specified date, optional offset.
update ... set servicemonth = eomonth(servicemonth)
Comments
Post a Comment