Forums Register Login

What am I doing wrong in this Stored Procedure

+Pie Number of slices to send: Send
I have written a stored procedure for MSSQL 2000 procedure search_result(@name VARCHAR,@address varchar)
AS
IF((@name IS NOT NULL AND @name <> '' AND @name <> ' ') AND(@address IS NULL OR @address <> '' OR @address <> ' '))
BEGIN
SELECT [postal_code]
FROM OM
WHERE [name] LIKE '%@name%'
END
.....
GO
Nothing is being returned I have tried it in the query analyzer
+Pie Number of slices to send: Send
figured my problem
where [name] like '%@name%'
should read where [name] like '%' + @name + '%'
+Pie Number of slices to send: Send
figured my problem
where [name] like '%@name%'
should read where [name] like '%' + @name + '%'
This is my favorite tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 903 times.
Similar Threads
Foreign key must have same number of columns as the referenced primary key
Varchar & Varchar2 in Stored procedure
JDBC Callable Statement JConnect2 Returning null resultset
How Hibernate invokes Stored Procedures
iBatis | Function Call as a Paramter to Procedure Call?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:58:48.