Paully1999
Programmer
I am trying to set up a stored procedure that accepts a comma-delimited string and displays all of the records that their zip code located within that string.
I have
CREATE PROCEDURE dbo_GetContractors
@WorkType varchar(1),
@Zippy nText
AS
SELECT Zip, Search_Id, State, City, Company_Name, WorkType1, banner, bold FROM ContractorsOnly WHERE WorkType1 = @WorkType AND Zip IN @Zippy ORDER BY Company_Name
GO
I get a syntax error by the IN @Zippy.
I expect the string to look like this...
('07002','07010','07022','07032','07047','07071','07073','07105','07657','07660','10011','10014','10016','10022','10028','10031','10169','10301','10306','10454','10461','11101','11103','11105','11106','11211','11217','11218','11222','11228','11229','11232','11238','11373','11377','11378','11385','11417','11419','11421')
I have
CREATE PROCEDURE dbo_GetContractors
@WorkType varchar(1),
@Zippy nText
AS
SELECT Zip, Search_Id, State, City, Company_Name, WorkType1, banner, bold FROM ContractorsOnly WHERE WorkType1 = @WorkType AND Zip IN @Zippy ORDER BY Company_Name
GO
I get a syntax error by the IN @Zippy.
I expect the string to look like this...
('07002','07010','07022','07032','07047','07071','07073','07105','07657','07660','10011','10014','10016','10022','10028','10031','10169','10301','10306','10454','10461','11101','11103','11105','11106','11211','11217','11218','11222','11228','11229','11232','11238','11373','11377','11378','11385','11417','11419','11421')