im working with a stored procedure in sql server 2005 DB, procedure has a piece of query that is
.
.
.
if(@zipCodeList <> '')
BEGIN
SET @zipCodeList = ''''+replace(replace(replace(@zipCodeList, ' ', ''),',',''','''),'_',' ')+''''
END
SELECT distinct ZIPCode
from zip_table
where ZIPCode_col IN (@zipCodeList)
AND power((69.1 * (abs(Longitude) - abs(Longitude)) * cos(abs(Latitude)/57.3)),2) +
Power(69.1 * (abs(Latitude) - abs(Latitude)), 2) <= (60 * 60)
AND more conditions
.
.
.
calling the procedure like
exec proc '02124, 23568'
DB has records, but procedure does not show anything, i printed the query and it prints
SELECT distinct ZIPCode
from zip_table
where ZIPCode_col IN ('02124','23568')
AND power((69.1 * (abs(Longitude) - abs(Longitude)) * cos(abs(Latitude)/57.3)),2) +
Power(69.1 * (abs(Latitude) - abs(Latitude)), 2) <= (60 * 60)
AND more conditions
and when i run this query this returns the correct result. looking like @zipCodeList
is causing some problem at run time but does not gives any error, can any one please help me where im wrong.
Thanks in advance.