views:

17

answers:

1

Hi,

I want to pass 2 parameters to SQL stored procedure and use "like" statement as so:

CREATE PROCEDURE dbo.StoredProcedure1
    @project varchar(max)
    @group varchar(50)
AS
BEGIN 
    SELECT * FROM table1 WHERE Projectname = @project and Resource_ID like '%' + @group + '%'
END

It says that there is incorrect syntax near @group and that I must declare scalar variable @project.

Any idea how can I make this work?

Thanks!

Greg

+1  A: 

Your parameter list has a missing comma

CREATE PROCEDURE dbo.StoredProcedure1
    @project varchar(max), --missing comma
    @group varchar(50)
AS
...
gbn
Thanks! Thats some silly mistake..too bad the compiler couldnt tell me that :(
Greg