Create next stored procedure
CREATE PROCEDURE dbo.SearchDebiors
(
@debName nvarchar(50)
@postNumb nvarchar(50)
@phoneNumb nvarchar(50)
)
AS
select * from Debitors where
[Name] like '%'+@debName+'%' and
cast(PostNumber as nvarchar(50)) like '%'+@postNumb+'%' and
(PhoneNumber like '%'+@phoneNumb+'%' or PhoneNumber is null)
RETURN
and cant save, every time error "incorrect syntax near @postNumb", must declare the scale variable @debName. Please help why?
Error in stored procedure "incorrect syntax near"
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Sandeep ShekhawatRank #2,439 · 577 reputationPosted Jun 28, 2011, 12:53 AM EDT
(
@debName nvarchar(50),
@postNumb nvarchar(50),
@phoneNumb nvarchar(50)
)
AS
select * from Debitors where
[Name] like '%'+@debName+'%' and
cast(PostNumber as nvarchar(50)) like '%'+@postNumb+'%' and
(PhoneNumber like '%'+@phoneNumb+'%' or PhoneNumber is null)
RETURN
use comma in declaration part in above i marked with green color. Error in parameter declaration part that i have bold use comma(,) to seprate each parameter.
Akkiraju IvaturiRank #473 · 5.3K reputationPosted Jun 30, 2011, 8:09 PM EDT