Simple Stored Procedure in SQL Server
When I run this stored procedure using this:
EXECUTE RecipeDetails.sp_InsertRecipe
@title='gumbo',
@introdution='intro',
@ingredients='onion',
@difficulty='easy',
@prepTimeHour=null,
@prepTimeMinute=null,
@inactiveTimeHour=null,
@inactiveTimeMinute=null,
@servings=null,
@photo=null
I get an error saying
Msg 201, Level 16, State 4, Procedure sp_InsertRecipe, Line 0
Procedure or function 'sp_InsertRecipe' expects parameter '@introduction', which was not supplied开发者_运维问答.
Can some please advise me as to why it's saying "introduction" isn't a valid column name?
I have the following SQL Server stored procedure:
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
If this code is verbatim to what you're running, then it's because you've misspelled "Introduction" when you call the procedure.
It's a simple typo: see your call to the stored proc:
EXECUTE RecipeDetails.sp_InsertRecipe
@title='gumbo',
@introdution='intro', <== TYPO HERE !! Should be @introduction !!
@ingredients='onion',
You've supplied a parameter @introdution
- but not @introduction
(you're missing a "c" in that name there)
You have Misspelled Your Field @Introduction
as '@Introdution'
I have Done Corrections Here:
EXECUTE RecipeDetails.sp_InsertRecipe
@title='gumbo',
@introduction='intro',
@ingredients='onion',
@difficulty='easy',
@prepTimeHour=null,
@prepTimeMinute=null,
@inactiveTimeHour=null,
@inactiveTimeMinute=null,
@servings=null,
@photo=null
精彩评论