1

私は次のようなストアドプロシージャを持っています

Create proc [dbo].[DNNCentric_TechAnyClass_Course_FilterByCategory]
@CategoryName nvarchar(350)='Business'
AS
BEGIN
Declare @Category nvarchar(350)
Set @Category=""
if(@CategoryName='Business')
begin
  Set @Category=@CategoryName
end
select Course.CourseId,Course.CourseTitle,Course.CourseDescription,Category.CategoryName,FormatMaster.FormatType,Teacher.TeacherName
From dbo.DNNCentric_TechAnyClass_CategoryMaster As Category 
     Inner Join dbo.DNNCentric_TechAnyClass_Course As Course ON Category.CategoryID = Course.CategoryId
     Inner Join dbo.DNNCentric_TechAnyClass_FormatMaster As FormatMaster ON FormatMaster.FormatID = Course.FormatID
     Inner Join dbo.DNNCentric_TechAnyClass_Teacher As Teacher ON Teacher.TeacherId=Course.TeacherId
Where    Category.CategoryName=@Category 
END

表示され、エラーが発生します

Msg 1038, Level 15, State 4, Procedure DNNCentric_TechAnyClass_Course_FilterByCategory, Line 6
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.

エラーは何ですか、私はコミットしています。助けてくれてありがとう。

4

1 に答える 1

5
Set @Category=""

する必要があります

SET @Category=''

二重引用符( ")はアポストロフィ(')である必要があります

于 2013-01-24T11:45:11.690 に答える