Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    51

    Unanswered: Trigger Enable in Microsoft SQL Server

    hi all ,
    I created the trigger by the statement
    CREATE TRIGGER trigname ON tablename FOR
    INSERT , DELETE AS .... END GO

    1) Can I enable and disable a trigger in Microsoft SQL Server as in Oracle ?

    Through SQL Query Analyser , I tried this sql statement ...
    --ALTER TRIGGER trigname ENABLE ---
    and get the error ------- Incorrect syntax near 'ENABLE'.


    2) Can I invoke a .bat file in a trigger event ?
    OR
    Can I load and invoke a java class in Microsoft SQL Server .



    ---

  2. #2
    Join Date
    May 2003
    Location
    Parsippany NJ
    Posts
    36
    (1)Yes, ALTER TABLE TBName DISABLE TRIGGER tr_a1

    (2)Yes, put

    Exec Master..xp_cmdshell 'c:\test.bat'

    In the trigger and replace within code with your bach location.

    I dont know about java class though

  3. #3
    Join Date
    Dec 2003
    Posts
    51

    Thanks A Lot !!!

    hi ClaireHsu,

    yes it is working properly .... now

    1) The enabling and disabling of MSSql Server trigger is working .
    2) The bat file is executing in the trigger event also.

    thanx for the help ...
    pinto

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •