INSERT上的SQL Server存储过程错误

时间:2012-11-11 11:41:19

标签: sql-server-2008 stored-procedures

我有一个简单的INSERT存储过程,最近我注意到我遇到了一些看起来不像是一个不寻常的错误

当我尝试编译以下存储过程时出现以下错误:

  

Msg 137,Level 15,State 2,Procedure usp_AddArticleCategory,Line 15
  必须声明标量变量“@ArtcileCategoryActive”。

这是我的代码:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- =============================================
CREATE PROCEDURE [dbo].[usp_AddArticleCategory]
    @ArticleCategoryName nvarchar(200),
    @LangID int,
    @ArticleCategoryActive bit,
    @Type nvarchar(100)
AS
    SET NOCOUNT ON;
BEGIN
    INSERT INTO art_Category (ArticleCategoryName,[LangID],ArtcileCategoryActive,[Type])
         VALUES (@ArticleCategoryName, @LangID, @ArtcileCategoryActive, @Type)
END

表格结构:

CREATE TABLE [dbo].[art_Category](
    [ArticleCategoryID] [int] IDENTITY(1,1) NOT NULL,
    [ArticleCategoryName] [nvarchar](200) NULL,
    [LangID] [int] NULL,
    [ArtcileCategoryActive] [bit] NULL,
    [Type] [nvarchar](100) NULL,
 CONSTRAINT [PK_art_Category] PRIMARY KEY CLUSTERED 
(
    [ArticleCategoryID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

我比较了表列,数据类型,但我不确定为什么会出现这种错误。

感谢您的帮助

1 个答案:

答案 0 :(得分:3)

你宣布了;

ArticleCategoryActive

并使用;

ArtcileCategoryActive

发现差异? :)