• its not necessary to have dynamic sql

    i had tried with normal query but didnot work so tried iwith dynamic sql

    the out needed is display

    1) date,amt with the given date range

    2) conditional where clause ie if @type<>'' then

    select * from tbl where date between @frmdt and @todt and type=@type

    if @cid<>'' then

    select * from tbl where date between @frmdt and @todt and cid=@cid

    if both not blank

    select * from tbl where date between @frmdt and @todt and cid=@cid and type=@type

    and both blank then

    select * from tbl where date between @frmdt and @todt