过程或函数 '*'需要参数 '@DeptCode',但未提供该参数。

ahhfql 2013-04-11 01:53:27
ALTER proc [dbo].[kqyjg_proc] @DeptCode VarChar(20),
@kqny Varchar(6)
as
delete from kqyjg where deptcode = @deptcode and d9999=@kqny
insert into kqyjg(d9999,deptcode,content,a0188,a0101)
select distinct d9999,deptcode,content,a0188,a0101 from kqyjg where deptcode = deptcode
and substring (convert(varchar(10),d9999,112),1,4)=substring(@kqny,1,4)
and substring (convert(varchar(10),d9999,112),5,2)=substring(@kqny,5,2)

执行
exec kqyjg_proc
select*from kqyjg
where deptcode=010001
and substring (convert(varchar(10),d9999,112),1,6)=201209

结果
消息 201,级别 16,状态 4,过程 kqyjg_proc,第 0 行
过程或函数 'kqyjg_proc' 需要参数 '@DeptCode',但未提供该参数。
...全文
1391 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
水族杰纶 2013-04-11
  • 打赏
  • 举报
回复
引用 7 楼 ahhfql 的回复:
exec kqyjg_proc select*from kqyjg where deptcode='010001' and substring (convert(varchar(10),d9999,112),1,6)='201209' 这两个就是参数 '010001','201209'
exec kqyjg_proc '010001','201209'
ahhfql 2013-04-11
  • 打赏
  • 举报
回复
exec kqyjg_proc select*from kqyjg where deptcode='010001' and substring (convert(varchar(10),d9999,112),1,6)='201209' 这两个就是参数 '010001','201209'
水族杰纶 2013-04-11
  • 打赏
  • 举报
回复
引用 5 楼 ahhfql 的回复:
2)下面的查询语句 该加引号的地方都没有 加引号也是提示这个
这两个没有任何关系 我只是顺带说下
ahhfql 2013-04-11
  • 打赏
  • 举报
回复
2)下面的查询语句 该加引号的地方都没有 加引号也是提示这个
發糞塗牆 2013-04-11
  • 打赏
  • 举报
回复
存储过程需要两个显式的参数,但是只提供了一个,准确来说你还没提供任意一个
hyrongg 2013-04-11
  • 打赏
  • 举报
回复
执行存储过程的时候要带2个参数 exec kqyjg_proc '',''
水族杰纶 2013-04-11
  • 打赏
  • 举报
回复
2)下面的查询语句 该加引号的地方都没有
水族杰纶 2013-04-11
  • 打赏
  • 举报
回复
提示不是很明显嘛 过程有参数且没有默认值 你执行时候没有提供参数值

27,579

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧