I simply want to get a procedure which displays names which start with letters Up (I'm trying to make an Auto complete for ASP.NET)
select * from Diagnose
Create proc spGetNames 'Up'
@term nvarchar (50)
as
Begin
Select Name
from Diagnose
where Name like @term + '%'
End
But this error keeps poping out:
Msg 102, Level 15, State 1, Procedure spGetNames, Line 3 [Batch Start Line 0]
Incorrect syntax near 'Up'.
Msg 137, Level 15, State 2, Procedure spGetNames, Line 9 [Batch Start Line 0]
Must declare the scalar variable "@term".
On youtube people did the same as me and it worked for them:
Any tips would be great :)
Remove 'Up' when you create Procedure
Create proc spGetNames
@term nvarchar (50)
as
Begin
Select Name
from Diagnose
where Name like @term + '%'
End
Execute your procedure like following
exec spGetNames 'Up'