希望这是一个简单的
示例数据
CalendarHeaders.Description
2 Days from today
5 Days from today
10 Days from today
到目前为止示例查询
SELECT
left(CalendarHeaders.Description, patindex('%[^0-9]%', CalendarHeaders.Description+'.') - 1) as Expiration,
GETDATE()as DateSold
示例结果(缺少DateExpires)
Expiration Datesold DateExpires
2 2012-07-17 04:26:10.283 2012-07-19 04:26:10.283
5 2012-07-17 04:26:10.283 2012-07-22 04:26:10.283
10 2012-07-17 04:26:10.283 2012-07-27 04:26:10.283
答案 0 :(得分:0)
您可以DATEADD
解析的日期到今天的日期;
dateadd(DAY, cast(left(CalendarHeaders.Description, patindex('%[^0-9]%', CalendarHeaders.Description+'.') - 1) as int), getdate()) AS DateExpires