Results 1 to 2 of 2

Thread: Help Needed

  1. #1
    Join Date
    Mar 2003
    Posts
    10

    Unanswered: Help Needed

    hi,
    i have table with following feilds

    ProgramId ProgramType AccountName ProgramName ProgramBudget ProgramStatus

    I need to write a search query to generate a report where search criteria will be (ProgramType=1,2,3 or All of above),(AccountName=a,b,c or All of above),(ProgramStatus=y,n or all of above)

    any clues,

    thnx in advance
    sudheer.

  2. #2
    Join Date
    Feb 2003
    Location
    Germany
    Posts
    53
    hi,

    try something like this:

    declare @PID int, @PTY int
    set @PID=null -- will search "all"
    set @PID=2 -- will search for ProgramID=2 etc
    :
    :
    select *
    from <tablename>
    where ((@PID is null) or (ProgramID=@PID)) and
    ((@PTY is null) or (ProgramType=@PTY))
    :



    markus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •