When I copied your code and passed in parameters as you mention in your first post and did a Select @strSQL this is what I got:
WITH Search AS
(
select
ROW_NUMBER() OVER ( order by pdt desc ) AS ROWID,
sid ,
title ,
url,
pdt,
intro,
intro2
from
(
select
art_id as sid ,
art_title as title,
'/article.aspx?artid='+art_encryptid as url ,
art_displaydt as pdt,
case art_index_intro
when '' then art_intro
else isnull(art_index_intro, art_intro)
end as intro,
substring(art_article,1,300) as intro2
from
us_article
where
art_status = 3 and
art_article_type!=5
P Soni
union
select
sect_id as sid ,
sect_title as title,
sect_page+sect_encryptid as url,
sect_publishdt as pdt,
case sect_index_intro
when '' then sect_intro
else isnull(sect_index_intro, sect_intro)
end as intro,
substring(sect_dtl,1,300) as intro2
from
us_section
where
sect_status = 3 and
sect_page is not null and
sect_page <> ''
P Soni
)a
)
select
*
FROM
Search
where
ROWID between 1 and 20
Note the bold parts. @art_Filter and @sect_Filter are not being compared to anything. At least for @sectFilter it looks like you do not have the parameter in the correct place. It looks like the parameter should be here:
sect_page <> ''' + isnull(@sect_Filter, '') + ''' ) )a '
I have no clue what to do with @art_Filter.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question