当我使用以下命令运行此存储过程时:
EXECUTE RecipeDetails.sp_InsertRecipe
@title='gumbo',
@introdution='intro',
@ingredients='onion',
@difficulty='easy',
@prepTimeHour=null,
@prepTimeMinute=null,
@inactiveTimeHour=null,
@inactiveTimeMinute=null,
@servings=null,
@photo=null
我收到错误说
Msg 201,Level 16,State 4,Procedure sp_InsertRecipe,Line 0
程序或功能 'sp_InsertRecipe'需要参数 '@introduction',但不是 提供。
有些人可以告诉我为什么说“介绍”不是有效的专栏名称?
我有以下SQL Server存储过程:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [RecipeDetails].[sp_InsertRecipe]
@title varchar(50),
@introduction varchar(255),
@directions varchar(2200),
@ingredients varchar(2200),
@difficulty varchar(6), or "expert"*/
@prepTimeHour tinyint,
@prepTimeMinute tinyint,
@inactiveTimeHour tinyint,
@inactiveTimeMinute tinyint,
@servings tinyint,
@photo varbinary(MAX)
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO RecipeDetails.Recipe (title, introduction, ingredients, difficulty,
prepTimeHour, prepTimeMinute, inactiveTimeHour, inactiveTimeMinute, servings, photo)
VALUES (@title, @introduction, @ingredients, @difficulty, @prepTimeHour, @prepTimeMinute,@inactiveTimeHour, @inactiveTimeMinute, @servings, @photo)
END
GO
答案 0 :(得分:4)
如果此代码逐字显示您正在运行的内容,那么这是因为您在调用该过程时拼错了“简介”。
答案 1 :(得分:1)
这是一个简单的错字:看到你对存储过程的调用:
EXECUTE RecipeDetails.sp_InsertRecipe
@title='gumbo',
@introdution='intro', <== TYPO HERE !! Should be @introduction !!
@ingredients='onion',
您已提供参数@introdution
- 但不 @introduction
(您在该名称中缺少“c”)
答案 2 :(得分:0)
您已将@Introduction
字段'@Introdution'
拼错为EXECUTE RecipeDetails.sp_InsertRecipe
@title='gumbo',
@introduction='intro',
@ingredients='onion',
@difficulty='easy',
@prepTimeHour=null,
@prepTimeMinute=null,
@inactiveTimeHour=null,
@inactiveTimeMinute=null,
@servings=null,
@photo=null
我在这里做了更正:
{{1}}