更新时间:2022-03-13 09:08:13
这是经过测试的解决方案.
THIS IS THE TESTED SOLUTION.
update personnaldetails
set dbdate = dateadd(day,(29-datepart(dd,dbdate)),dbdate)
I不知道这是否可以轻松地使用SQL来实现.我将放置SELECT查询以获取列表,然后对于每条记录,将其提取为DateTime类型.然后使用更新的日期进行更新.
修改DateTime的示例:
I do not know if this can be easly use SQL to achive this. I would put SELECT query to get a list and then for each record I would fetch into DateTime type. Then update with updated date.
Example to modify DateTime:
DateTime dt = DateTime.Now.Date.AddDays(2);
dt = dt.AddMonth(1);
dt = dt.AddYear(1);
您知道,如果您使用google,则编码会更快:
http://msdn.microsoft.com/en-us/library/ms186724.aspx [ ^ ]
You know, your coding would go A LOT faster if you used google:
http://msdn.microsoft.com/en-us/library/ms186724.aspx[^]