注册 登录
编程论坛 SQL Server论坛

前辈们帮我看看,怎么解决

落日幻影 发布于 2013-10-14 17:17, 546 次点击
if exists(select * from sysobjects where name='wwe' and type='p')
drop proc wwe
go
create proc wwe @ID INT,@CD int output, @NM varchar(8) output
as
select @CD= student_code from stident_info where student_id=@ID
select @NM= student_name from stident_info where student_id=@ID
return
go
declare @return_CD int
declare @return_NM VARCHAR(8)
EXEC WWE @ID='119',@RETURN_CD OUTPUT,@RETURN_NM OUTPUT
SELECT @return_CD AS '学号',@return_NM as '姓名'
go

错误提示:必须传递参数个数 2,并以 '@name = value' 的形式传递后续的参数。一旦使用了 '@name = value' 形式之后,所有后续的参数就必须以 '@name = value' 的形式传递。
3 回复
#2
Aviva_Wang2013-10-15 09:01
EXEC WWE @ID='119',@return_CD = @RETURN_CD OUTPUT,@return_NM =@return_NM OUTPUT
或者
 EXEC WWE '119', @RETURN_CD OUTPUT ,@return_NM OUTPUT
#3
落日幻影2013-10-16 13:41
回复 2楼 Aviva_Wang
谢谢了
#4
volte2013-10-17 16:56
@ID 定义为 int , 传参还传字符。
典型的基本语法错误!!
1