how to generate dynamic variable in stored procedure

  • I have to generate a report using reporting services . i have to get the count the memebers who are died with habit of smoking,alchol,pan,tobacco or combination of two

    combination of 3 or combination of 4 habits

    report format like:

    cause of death sex below15,'15-24','24-34','34-44','45-54','55-64','65-69','above70'

    tyhphoid

    MALE

    FEMALE

    MALARIA

    MALE

    FEMALE

    i have written a storedprocedure with select statement like

    SET @BEL15=(SELECT COUNT(*) FROM death_statistics WHERE smok_yes=@smokeyes or tob_yes=@tobyes or alc_yes=@alcyes or pan_yes=@panyes and

    SEX='M' AND AGE_IN='Y' and AGE<15 AND CAUSE_CODE=@CAUSECODE AND REG_YEAR=@YEAR AND ST_CODE=@STCODE )

    print @BEL15

    SET @15TO24=(SELECT COUNT(*) FROM death_statistics WHERE smok_yes=@smokeyes or tob_yes=@tobyes or alc_yes=@alcyes or pan_yes=@panyes and

    and SEX='M' AND AGE_IN='Y' AND AGE>=15 AND AGE<=24 AND CAUSE_CODE=@CAUSECODE AND REG_YEAR=@YEAR AND ST_CODE=@STCODE) but i want to how to assign a dynamic input variable to append in where caluse
    to pass the selected habit

    so any one can help me

  • Check out this article

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply