触发器中删除数据库中的表
发布网友
发布时间:2022-04-30 13:18
我来回答
共3个回答
热心网友
时间:2022-06-22 13:49
你可以试一下
CREATE TRIGGER CRITRIA_DEL ON dbo.DSS_Criteria FOR DELETE
AS
declare @CriteriaID int, @CriteriaName varchar(50)
select @CriteriaID=deleted.CriteriaID,@CriteriaName=deleted.CriteriaName from deleted
IF Exists(Select * From sysObjects Where Name =@CriteriaName And Type In ('S','U'))
BEGIN
EXEC('DROP TABLE '+@CriterriaName)
END
热心网友
时间:2022-06-22 13:49
@可以用吗?
热心网友
时间:2022-06-22 13:50
好的