首先我想实现:“ 当新增或者修改表数据、某一列满足条件时(如A=某值),另外一列才限制“不可为空”。
当前代码我只能写到这一步、加个限制条件后就无法控制了。
USE [UFDATA_001_2018]
GO
/****** Object: Trigger [dbo].[cqcc_www_ceshi] Script Date: 2019-05-05 8:59:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER trigger [dbo].[cqcc_www_ceshi] on [dbo].[rdrecords01]
for insert,update
as
declare @a nvarchar set @a=(select cBatch from RdRecords01 where AUTOID in (select AUTOID from inserted))
if @a is null and cinvcode=01002
begin print '没有录入批号!'
rollback
end
请教大神这个该如何编写
if...else...就可以了呀