I'm trying (in vain) to use the DelimitedSplit8K function to pass a delimited list to my stored procedure to filter my underlying resultset
Here's my SQL
CREATE PROCEDURE BuildDatesForReport
( @StartDate DATETIME
, @EndDate DATETIME
, @BuildEventTypes VARCHAR(80)
)
AS
BEGIN
SELECT BuildSite.SiteName, House.LotNumber, House.HouseID, House.Homeowner, BuildDates.bhHouseID, BuildDates.HouseBuildDate, BuildDates.BuildEventType
FROM House INNER JOIN
BuildSite ON House.hBuildSiteID = BuildSite.SiteID INNER JOIN
BuildDates ON House.HouseID = BuildDates.bhHouseID
WHEREBuildDates.HouseBuildDate BETWEEN @StartDate AND @EndDate
ANDBuildDates.BuildEventType IN (dbo.DelimitedSplit8K(@BuildEventTypes,','));
END
If I leave out the @BuildEventType part, everything works fine.
I was trying to follow this article http://www.sqlservercentral.com/articles/T-SQL/73838/ but there's something there I just don't get. DelimitedSplit8K returns a table, so shouldn't I just join to the table?
Sorry to be so thick. There's just something here that I just goes right over my head!
Thanks!
Pieter