Monday, March 26, 2012

Problem related to trigger

hi ,
is it possible to use indexof and substring function in trigger.
i am using sql server 2005, please help me how to use string function
in trigger.
thanks
sathya narayanan
narayanan@.gsdindia.com
Hi
SQL Server 2005 Beta/CTP questions to:
http://communities.microsoft.com/new...=sqlserver2005
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"sathya" wrote:

> hi ,
> is it possible to use indexof and substring function in trigger.
> i am using sql server 2005, please help me how to use string function
> in trigger.
> thanks
> sathya narayanan
> narayanan@.gsdindia.com
>
|||hi,
when i am creating update trigger , i cannot read binary or image data
in trigger , i am using sql server 2005 , please help me how to use
image data in after update trigger
my sample code:
alter trigger docsUpdate
on docs
after update
as
declare @.metainfo binary(8000)
declare @.startIndex int
declare @.endIndex int
declare @.metainfoProcc varchar(8000)
declare @.guid varchar(8000)
declare @.order varchar(8000)
Declare metaInfoVal CURSOR for select metainfo from deleted
open metaInfoVal
fetch next from metaInfoVal into @.metainfo
while @.@.fetch_status =0
begin
set @.metainfoProcc = cast(@.metainfo as varchar(8000))
set @.startIndex = charindex('GUID:SW|',@.metainfoProcc,1)+9
set @.endIndex = charindex('*',@.metainfoProcc,@.startIndex)
set @.guid = substring(@.metainfoProcc ,@.startIndex ,
@.endIndex-@.startIndex)
set @.startIndex = charindex('Order:SW|',@.metainfoProcc,1)+9
set @.endIndex = charindex('*',@.metainfoProcc,@.startIndex)
set @.order = substring(@.metainfoProcc ,@.startIndex
,@.endIndex-@.startIndex)
print 'Guid:'+@.guid
print 'order:'+@.order
fetch next from metaInfoVal into @.metainfo
end
close metaInfoVal
deallocate metaInfoVal
it shows error as :
Msg 311, Level 16, State 1, Procedure docsUpdate, Line 11
Cannot use text, ntext, or image columns in the 'inserted' and
'deleted' tables.
sathya narayanan v
narayanan@.gsdindia.com

No comments:

Post a Comment