MS SQL 创建过程时服务器错误

MS SQL server error while making a procedure

我只是想获得一个显示以字母 Up 开头的名称的过程(我正在尝试为 ASP.NET 自动完成)

select * from Diagnose

Create proc spGetNames 'Up'
@term nvarchar (50)
as
Begin
    Select Name
    from Diagnose
    where Name like @term + '%'
End

但是这个错误不断出现:

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".

在 youtube 上,人们和我做的一样,并且对他们有用:

任何提示都会很棒 :)

  1. 创建过程时删除'Up'

    创建进程 spGetNames
    @term nvarchar (50)
    作为
    开始
    Select 姓名
    来自诊断
    其中 Name like @term + '%'
    结束

  2. 按如下方式执行您的程序

    exec spGetNames 'Up'