• Well the condition should not on 13 rows before , it should be on thirteenths days before

    as below

    select ID,

    Symbol_Code,

    Transaction_date,

    Close_Price

    from EOD_NSE_Stock

    where

    Transaction_date between

    dateadd(day, -13, getdate()) and getdate()

    and

    Symbol_Code=@Symbol_Code

    so there might be possibilty that i may miss some rows becoz of having holiday on some days.

    thats why i m checking the the if else conditionto have exact 13 days data .