declare @EndDate varchar(50)
set @EndDate = '2014-11-17'
declare @monthend varchar(50)
set @monthend = 'select' + ' '+ 'MONTH('+ ''''+@EndDate+''''+')'
declare @flag int
set @flag = exec @monthend
select @flag
if @flag ='11'
I want to store result comes from dynamic query @monthend into variable @flag.and use the value @flag in the if else condition.