Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Proceedure to capture Array of Values

Status
Not open for further replies.

vcujackson

Technical User
Apr 7, 2009
18
0
0
US
alter procedure school_lookup1
@schoolyear1 char (2) = ''
@schoolyear2 char (2) = ''
@schoolyear3 char (2) = ''
@degreeyear1 char (4) = ''
@degreeyear2 char (4) = ''
@degreeyear3 char (4) = ''
@schoolname1 char (65) = ''
@schoolname2 char (65) = ''
@schoolname3 char (65) = ''
as
select schoolid, schoolyear,schoolname,degreeyear
from school_lookup1
where schoolyear in (@schoolyear1,@schoolyear2,@schoolyear3)
and
degreeyear in (@degreeyear1,@degreeyear2,@degreeyear3)
and
schoolname in (@schoolname1,@schoolname2,@schoolname3)

Is there a way to re-work this stored procedure so that it can capture a range of the forementioned values. For example, the degree years go back to 1900 and I would not want to do parameters for all those years
 
May be instead of IN you can use BETWEEN to include all years, e.g.

DegreeYear between @StartYear and @EndYear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top