Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to trace trigger codes
Message
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
How to trace trigger codes
Miscellaneous
Thread ID:
00542892
Message ID:
00542892
Views:
49
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
Map
View

Click here to load this message in the networking platform