For some reason this procedure returns 0 records:
CREATE PROCEDURE get_association_by_name
(
@association_name varchar(50)
)
AS
SELECT
association_id,
association_name,
association_acronym,
phone,
city,
state,
zip
FROM association
WHERE association_name like '%@association_name%'
ORDER BY
association_name
return (@@error)
It executes fine (no errors), but just returns an empty recordset. I cut and paste the select into query analyzer (substituting actual string for @association_name) and it returns the data no problem.
I'm fairly new to working with stored proc's, but have never had any problems with this type of thing before. The only difference from anything I have done in the past is this time my where clause is evaluating a varchar. Would an EXEC statement help? Any help is greatly appreciated.
Matt.
CREATE PROCEDURE get_association_by_name
(
@association_name varchar(50)
)
AS
SELECT
association_id,
association_name,
association_acronym,
phone,
city,
state,
zip
FROM association
WHERE association_name like '%@association_name%'
ORDER BY
association_name
return (@@error)
It executes fine (no errors), but just returns an empty recordset. I cut and paste the select into query analyzer (substituting actual string for @association_name) and it returns the data no problem.
I'm fairly new to working with stored proc's, but have never had any problems with this type of thing before. The only difference from anything I have done in the past is this time my where clause is evaluating a varchar. Would an EXEC statement help? Any help is greatly appreciated.
Matt.