declare @tags1 varchar(max)
declare @blockcount int
declare @blockstring varchar(max)
set @tags1='%Gifts%' Or CategoryTag Like'%Packaging%'
set @blockstring= 'SELECT @blogcount=count(*) FROM M_PHBLogs where CategoryTag LIKE '+ @tags1 +' AND ContentType=1 '
exec (@blockstring)
I want to store the result of exec(@blockstring) into another variable like
@blockcount=exec(@blockstring)
if(@blockcount!=0)
BEGIN
//something
END