USE [test1]
GO
/****** 对象: Trigger [dbo].[tri_test1] 脚本日期: 03/23/2011 08:43:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GOALTER TRIGGER [dbo].[tri_test1]
ON [dbo].[T_Test]
for INSERT
AS
BEGIN
SET NOCOUNT ON;
declare @word varchar(100)
declare @id int
select @id = id from inserted
select @word = [word] from inserted
declare @wordreplace varchar(100)
set @wordreplace = stuff(@word,charindex('(',@word),charindex(')',@word) - charindex('(',@word) + 1,'')
update T_Test set [word]=@wordreplace where id= @id
print 'asdsadsad'
END
这还是我昨天提过的一个问题,但这只能实现把标题后边带圆括号的内容删掉,现在要求是把标题后边不管是什么都能删掉
GO
/****** 对象: Trigger [dbo].[tri_test1] 脚本日期: 03/23/2011 08:43:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GOALTER TRIGGER [dbo].[tri_test1]
ON [dbo].[T_Test]
for INSERT
AS
BEGIN
SET NOCOUNT ON;
declare @word varchar(100)
declare @id int
select @id = id from inserted
select @word = [word] from inserted
declare @wordreplace varchar(100)
set @wordreplace = stuff(@word,charindex('(',@word),charindex(')',@word) - charindex('(',@word) + 1,'')
update T_Test set [word]=@wordreplace where id= @id
print 'asdsadsad'
END
这还是我昨天提过的一个问题,但这只能实现把标题后边带圆括号的内容删掉,现在要求是把标题后边不管是什么都能删掉
set @wordreplace = stuff(@word,charindex('(',@word),len(@word) - charindex('(',@word) + 1,'')