A和Y是什么意思?

liao71 2003-12-04 07:53:53
create procedure GetInspected
@ckyear int=null,
@ckmonth int=null,
@vendor varchar(30)=null,
@flag char(1)=null
as
if(@flag='A')
begin
select item=count(*) from InGoods where vendor=@vendor
and CKYEAR=@ckyear and CKMONTH=@ckmonth
return
end

if(@flag='Y')
begin
select item=count(*) from InGoods where vendor=@vendor
and CKYEAR=@ckyear and CKMONTH=@ckmonth and STATUS='OK'
return
end
go
if(@flag='A') 和if(@flag='表示什么意思?在此先谢了')
...全文
279 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
azsoft 2003-12-04
  • 打赏
  • 举报
回复
如果程序调用此存储过程时,如果是"A"就执行
select item=count(*) from InGoods where vendor=@vendor
and CKYEAR=@ckyear and CKMONTH=@ckmonth
return

如果程序调用此存储过程时,如果是"Y"就执行
select item=count(*) from InGoods where vendor=@vendor
and CKYEAR=@ckyear and CKMONTH=@ckmonth and STATUS='OK'
return
txlicenhe 2003-12-04
  • 打赏
  • 举报
回复
在前面还加上了这句是什么判断这个存储过程有还是没有吗?
use buygoods1
go
if object_id('dbo.GetOrderNum') is not null
drop procedure dbo.GetOrderNum
go


如果存在该存储过程就先删除。
realgz 2003-12-04
  • 打赏
  • 举报
回复
是。
liao71 2003-12-04
  • 打赏
  • 举报
回复
在前面还加上了这句是什么判断这个存储过程有还是没有吗?
use buygoods1
go
if object_id('dbo.GetOrderNum') is not null
drop procedure dbo.GetOrderNum
go
pengdali 2003-12-04
  • 打赏
  • 举报
回复
if @flag='a'

如果 参数@flag的值等于常量A的话就执行
txlicenhe 2003-12-04
  • 打赏
  • 举报
回复
@flag是存储过程的输入参数,如果在调用该存储过程时该参数值为'A',则执行if(@flag='A')后面的代码,其余同理
pengdali 2003-12-04
  • 打赏
  • 举报
回复
条件判断呀,如果@flag...就执行第一段

34,873

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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