Re: Question: Triggers
From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 02/24/04
- Next message: Jasper Smith: "Re: database restore from backup file."
- Previous message: Tom Moreau: "Re: Question: Triggers"
- In reply to: VB Programmer: "Re: Question: Triggers"
- Messages sorted by: [ date ] [ thread ]
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.) > > > > > >
- Next message: Jasper Smith: "Re: database restore from backup file."
- Previous message: Tom Moreau: "Re: Question: Triggers"
- In reply to: VB Programmer: "Re: Question: Triggers"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|