邹建,请进来帮我看看。谢谢!(没分了,下次补过)
我创建了一个trigger,调用sp_testdll,想触发执行该存储过程,但是出了下面的一些错误信息提示(不能在事务内部执行过程 'sp_addextendedproc'
),我在查询分析器里执行该存储过程可以,请问是什么原因?怎样才能在trigger里执行存储过程呢?
CREATE PROCEDURE sp_testdll AS
exec sp_addextendedproc "SetFileName","StoreProc.dll"
exec sp_addextendedproc "addLine","StoreProc.dll"
declare @szFileName varchar(200)
declare @szText varchar(200)
declare @rt int
select @szFileName="C:\WelCome.txt"
exec @rt=SetFileName @szFileName
if @rt=0
begin
select @szText="Welcome 01"
exec @rt=addLine @szText
end
exec sp_dropextendedproc "SetFileName"
exec sp_dropextendedproc "addLine"
dbcc SetFileName (free)
dbcc addLine (free)
GO