--存储过程的功能:对表 UBS_CAS_PriceFormBatch 进行添加、更新、删除、获取操作。
--参数说明:
成都创新互联是一家专业提供木兰企业网站建设,专注与网站设计、网站建设、H5网站设计、小程序制作等业务。10年已为木兰众多企业、政府机构等服务。创新互联专业网站制作公司优惠进行中。
/*
@DataAction 添加更新删除的标志位
@ID ID
@BatchNo ('批次号')
@ItemClassID 分类
@PurchaserUID 分类
@AuditorUID 批准人
@CheckerUID 审核者
@PubDate 拟制时间
@CheckDate 审核时间
@PassDate 批准时间
@State 表单状态
@FormType 表单类型
@SupplierCode 供应商代码
@CompanyType 厂别
@InputModelMaterial 输入成本模型的物料
@Purchaser
@Auditor
@Checker
@RejectReason
*/
Create PROCEDURE UBS_CAS_PriceFormBatchAction
@DataAction int,
@ID int = 0,
@BatchNo varchar(50),
@ItemClassID int,
@PurchaserUID int,
@AuditorUID int,
@CheckerUID int,
@PubDate datetime,
@CheckDate datetime,
@PassDate datetime,
@State int,
@FormType int,
@SupplierCode varchar(50),
@CompanyType int,
@InputModelMaterial varchar(50),
@Purchaser varchar(50),
@Auditor varchar(50),
@Checker varchar(50),
@RejectReason varchar(500)
AS
begin tran
SET NOCOUNT ON
if @DataAction=0
begin
insert into UBS_CAS_PriceFormBatch
(
[BatchNo],
[ItemClassID],
[PurchaserUID],
[AuditorUID],
[CheckerUID],
[PubDate],
[CheckDate],
[PassDate],
[State],
[FormType],
[SupplierCode],
[CompanyType],
[InputModelMaterial],
[Purchaser],
[Auditor],
[Checker],
[RejectReason]
)
values
(
@BatchNo,
@ItemClassID,
@PurchaserUID,
@AuditorUID,
@CheckerUID,
@PubDate,
@CheckDate,
@PassDate,
@State,
@FormType,
@SupplierCode,
@CompanyType,
@InputModelMaterial,
@Purchaser,
@Auditor,
@Checker,
@RejectReason
)
set
@ID=scope_identity()
end
if @DataAction=1
begin
Update [UBS_CAS_PriceFormBatch] SET
[BatchNo] = @BatchNo,
[ItemClassID] = @ItemClassID,
[PurchaserUID] = @PurchaserUID,
[AuditorUID] = @AuditorUID,
[CheckerUID] = @CheckerUID,
[PubDate] = @PubDate,
[CheckDate] = @CheckDate,
[PassDate] = @PassDate,
[State] = @State,
[FormType] = @FormType,
[SupplierCode] = @SupplierCode,
[CompanyType] = @CompanyType,
[InputModelMaterial] = @InputModelMaterial,
[Purchaser] = @Purchaser,
[Auditor] = @Auditor,
[Checker] = @Checker,
[RejectReason] = @RejectReason
Where
[ID] = @ID
end
if @DataAction=2
begin
delete from [UBS_CAS_PriceFormBatch] where [ID] = @ID
end
if @DataAction=3
begin
select
[BatchNo],
[ItemClassID],
[PurchaserUID],
[AuditorUID],
[CheckerUID],
[PubDate],
[CheckDate],
[PassDate],
[State],
[FormType],
[SupplierCode],
[CompanyType],
[InputModelMaterial],
[Purchaser],
[Auditor],
[Checker],
[RejectReason],
from [UBS_CAS_PriceFormBatch]
where
[ID] = @ID
end
if @@error<>0 goto sqlerr
commit tran
return
sqlerr:
rollback
SET NOCOUNT OFF
GO
上文中的内容主要是以代码的形式展现出来的,对于刚入门的初学者可能比较难理解,希望大家都能很好的掌握这些知识,为大家以后工作带来方便。
【编辑推荐】
当前题目:一个存储过程实现增删操作
网站地址:http://www.shufengxianlan.com/qtweb/news7/247857.html
成都网站建设公司_创新互联,为您提供静态网站、软件开发、品牌网站建设、域名注册、外贸网站建设、用户体验
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联