hi Dean this is what im looking for.
one more thing here i want to concatenate a static(constant) group by expression also.
can some help on this.
declare @tblExpressions table (id int primary key, predicate varchar(100))
declare @expression nvarchar(300) = ''
insert into @tblExpressions (id, predicate)
values (1, 'a = 1'), (2, 'b = 2'), (3, 'c = 3')
set @expression = 'select a, b, c from tblX where '
select
@expression = @expression + te.predicate + ' and '
from @tblExpressions te
select @expression
exec sp_executesql @expression
No comments:
Post a Comment