Perhaps something like this:declare @s char(5)set @s = '01Q13'select dateadd(year, convert(int, right(@s, 2)), startDt) as startDt ,dateadd(year, convert(int, right(@s, 2)), endDt) as endDtfrom ( select '01', convert(datetime, '2000-01-01'), convert(datetime, '2000-03-31') union all select '02', convert(datetime, '2000-04-01'), convert(datetime, '2000-06-30') union all select '03', convert(datetime, '2000-07-01'), convert(datetime, '2000-09-30') union all select '04', convert(datetime, '2000-10-01'), convert(datetime, '2000-12-31') ) d ([Q], [startDt], [endDt])where Q = left(@s, 2)OUTPUT:startDt endDt----------------------- -----------------------2013-01-01 00:00:00.000 2013-03-31 00:00:00.000
Be One with the OptimizerTG