Re: Question: Triggers

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 02/24/04


Date: Tue, 24 Feb 2004 19:44:45 +0100

I would go with Tom's suggestion. You want your triggers to be quick and
small. Shelling out to the OS is not a quick thing to do inside a trigger.
Plus all sort of things can go wrong.
You can create have your code just poll the table regularly, or write your
code so it runs through what it has to do and then exit (and schedule it
through SQL Server Agent regularly).

-- 
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
news:%23VOYtTw%23DHA.2808@TK2MSFTNGP10.phx.gbl...
I guess I could have a VB.NET time that constantly checks the value of a
fields to see if it's changed. Is this the best way? Very efficient? Thanks!
  "Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:ubBlULw%23DHA.808@TK2MSFTNGP12.phx.gbl...
  Could your VB.NET app not check for the existence of rows in a table via a
stored proc?
  -- 
  Tom
  ---------------------------------------------------------------
  Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
  SQL Server MVP
  Columnist, SQL Server Professional
  Toronto, ON Canada
  www.pinnaclepublishing.com/sql
  "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
news:#2h54Iw#DHA.3032@TK2MSFTNGP10.phx.gbl...
  I have a VB.NET application which searches for the existence of these
"trigger" files.  When it sees the file it does alot of logic, then sends
out emails (based on the logic).  After, the file is deleted.
    "Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:OjXVyEw%23DHA.2576@tk2msftngp13.phx.gbl...
    What is the purpose of the file?  How will it be used?  If you are using
this as some sort of data feed, I'd be more tempted to use the trigger to
populate a table and then extract the table via bcp or DTS to a file and
ship the file.
    -- 
    Tom
    ---------------------------------------------------------------
    Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
    SQL Server MVP
    Columnist, SQL Server Professional
    Toronto, ON Canada
    www.pinnaclepublishing.com/sql
    "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
news:uONCc6v#DHA.3120@TK2MSFTNGP11.phx.gbl...
    It only contains a numeric value.
    For example, if field A changes to 1 I'll put 50 in the file.  The name
of
    the file will be the rowid column.  If field B changes to 1 I'll put 30
in
    the file.  Etc...
    "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote
in
    message news:OqQPtyv%23DHA.552@TK2MSFTNGP11.phx.gbl...
    > What should the file contain?
    >
    > You could create a cursor which loops the inserted table inside the
    trigger
    > and for each row use xp_cmdshell to execute some "DOS" command which
    creates
    > the file.
    >
    > -- 
    > Tibor Karaszi, SQL Server MVP
    > Archive at:
    >
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
    >
    >
    > "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
    > news:esMAndv%23DHA.3272@TK2MSFTNGP09.phx.gbl...
    > > I am new to SQL Server.  Whenever a field in a database table
changes
    from
    > 0
    > > to 1 I want to automatically create a text file in my
C:\Temp\Trigger
    > > directory.  The filename is the id of the row.
    > >
    > > Can I do this using a SQL Trigger?  What do you suggest?
    > >
    > > (My main development environment is VS.NET.)
    > >
    > >
    >
    >


Relevant Pages

  • Re: Trigger Question
    ... Pro SQL Server 2000 Database Design - ... I just decided that if my trigger for delete was ... >> SQL Server MVP ... >>> UPDATE OrderDetail ...
    (microsoft.public.sqlserver.programming)
  • Re: Records not inserting...
    ... > I am totally new to SQL server. ... However, in a trigger, would I be ... test the effects of certain data modifications and to set conditions for ... UPDATE statements. ...
    (microsoft.public.sqlserver.odbc)
  • Re: Help for an Oracle Newbie
    ... application I wrote using SQL Server ported over to Oracle. ... Obviously there are several built in data types in SQL Server that do ... Of course I had to use a different name for the trigger under each ...
    (comp.databases.oracle.server)
  • Re: TRIGGER (AFTER INSERT) and Store Procedure ... insert failed !
    ... >into SQL server, the record exist anyway! ... >If you refresh the data you will see the record... ... it gets refreshed after trigger excecution automatically. ... I don't know your monitoring system, but I guess that removing the result ...
    (microsoft.public.sqlserver.programming)
  • Re: how to assign the contents of a field to a variable
    ... > Columnist, SQL Server Professional ... > teh requirements of the trigger are to export an XML document to MSMQ ... > DECLARE @int_msmqqueue INT ... > DECLARE FieldCursor CURSOR ...
    (microsoft.public.sqlserver.programming)