带参输入的存储过程,怎么改。紧急!!!!!!!!在线等候

lyszjs 2005-04-08 08:55:00
exec md_sellsum '12','2004-09-07','2004-09-08'

CREATE PROCEDURE md_sellsum
@md_uid varchar(25),
@begin_date datetime='',
@end_date datetime=''
as
select md_uid=@md_uid, sum(total_sale) totalsum,sum(total_sale-total_cost)
gross,count(b.num) custnum
from
td_outhead a,td_pay_info b
where
a.md_uid=@md_uid and sale_date=oper_date and
oper_date between
@begin_date and @end_date and
b.md_uid=a.md_uid
group by a.md_uid
go

这个存储过程语法检查的时候没错误,但执行的时候不行。
错误提示为:对象名 'td_outhead' 无效。对象名 'td_pay_info' 无效。
md_uid 作为输入参数在存储过程中被引用是不是有错。

...全文
73 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wyb0026 2005-04-08
  • 打赏
  • 举报
回复
没有这两个表吧,或者这两个表的所有者不是dbo
talantlee 2005-04-08
  • 打赏
  • 举报
回复
你寫的太亂了,你把2個表的結構給出來
631799 2005-04-08
  • 打赏
  • 举报
回复
看看对象的所有者是不是都是dbo?
zhoutiance 2005-04-08
  • 打赏
  • 举报
回复
这个是提示没有'td_outhead' 和'td_pay_info' 表

27,579

社区成员

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

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