How could I add in more parameters? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How could I add in more parameters?

Here’s the code…<br /><br />DECLARE @trustid varchar(20) SET @trustid = ‘P031172’ SELECT tblPatient.TrustID ‘Trust ID’, tblTeams.Description ‘Team Name’, (case when tblTeamCare.EndDate is null then ‘Active’ else ‘Inactive’ end) as ‘Status’ FROM tblTeamCare INNER JOIN tblTeams ON tblTeamCare.TeamID = tblTeams.TeamID INNER JOIN tblPatient ON tblTeamCare.PatientID = tblPatient.PatientID and trustid = @trustid <br /><br />Now, where ‘Po31172’ is listed, I also have another 20 similar values (‘Po31173/4/5′ etc) to run. Could the TSQL be re-written so that I can copy and paste, add commas if necessary, and run?<br /><br />Obviously, I could copy and paste the above 20 times and simply alter the number each time… <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ /><br /><br />Thanks in advance, <br /><br /><br />Jaybee.<br /><br />France.<br /><br />The finest wines.<br /><br />The tastiest cuisine.<br /><br />The most delicious women.
Don’t you have table that has TrustId as its key?