General information
Forum:
Microsoft SQL Server
Title:
How to trace trigger codes
Hi,
I have the following downloaded sample codes added to my trigger on Insert, Update and Delete:
DECLARE
@FS INT,
@OLEResult INT,
@FileID INT,
@FileName varchar(255),
@Text1 varchar(8000)
Set @FileName = 'C:\MyDir\file.txt'
Set @Text1 = 'Text to write'
EXECUTE @OLEResult = sp_OACreate 'Scripting.FileSystemObject', @FS OUT
IF @OLEResult <> 0 PRINT 'Scripting.FileSystemObject'
--Open a file
EXECUTE @OLEResult = sp_OAMethod @FS, 'OpenTextFile', @FileID OUT,
@FileName, 8, 1
IF @OLEResult <> 0 PRINT 'OpenTextFile'
--Write Text1
EXECUTE @OLEResult = sp_OAMethod @FileID, 'WriteLine', NULL, @Text1
IF @OLEResult <> 0 PRINT 'WriteLine'
EXECUTE @OLEResult = sp_OADestroy @FileID
EXECUTE @OLEResult = sp_OADestroy @FS
----------------------------------------
When I insert a record into the table, the trigger does not seem to work.
How do I trace my codes ? I tried inserting the PRINT command but no display is show ....
PS. I am a novice on MS SQL
Please advice
Cheers.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only