简单存储过程问题 [英] Simple Stored Procedure Question
本文介绍了简单存储过程问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在 VS 2010/SQL Server 2008 中创建一个简单的存储过程,如下所示:
I am creating a simple stored procedure in VS 2010/SQL Server 2008 as follows:
<代码>创建程序返回价格@carID 整数@price十进制(18,2)输出作为SELECT @price = Price from Cars WHERE CarID = @carID
并且我在尝试保存时收到以下错误消息:
and I am receiving the following error message when attempting to save:
'@price' 附近的语法不正确必须声明标量变量@price"
Incorrect syntax near '@price' Must declare the scalar variable "@price"
任何关于我哪里出错的提示或提示将不胜感激.
Any pointers or tips as to where I am going wrong will be much appreciated.
谢谢.
推荐答案
你需要用逗号分隔你的参数!
You need to separate your parameters with commas!
CREATE PROCEDURE ReturnPrice
@carID int,
@price decimal(18,2) output
AS
SELECT
@price = Price
FROM
dbo.Cars
WHERE
CarID = @carID
这篇关于简单存储过程问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文