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
sect_page <> ''' + isnull(@sect_Filter, '') + ''' ) )a '