From: Guillaume Marcais Date: 2004-04-22T11:16:26+09:00 Subject: Re: MS SQL triggers and ruby Thanx Le 21 avr. 04, � 19:59, Shashank Date a �crit : > > "Guillaume Marcais" wrote in message >> Is there a way for a trigger in MS SQL 2000 to fire some ruby code? I >> would like to act upon the insertion of some data in the database. > > Sure ! First make sure that you do not have any important table named > RUBY_TEST in the PUBS database and run this in Query Analyzer : > ----------------------------------------------------------------------- > USE PUBS > > IF OBJECT_ID('RUBY_TEST','U') is not NULL > DROP TABLE RUBY_TEST > > CREATE TABLE RUBY_TEST(A INT) > > GO > > IF EXISTS (SELECT name > FROM sysobjects > WHERE name = N'trig_test' > AND type = 'TR') > DROP TRIGGER trig_test > GO > > CREATE TRIGGER trig_test > ON RUBY_TEST > FOR DELETE, INSERT, UPDATE > AS > BEGIN > EXEC master..xp_cmdshell 'c:\ruby\bin\ruby -ve "puts %Q{Hello World}"' > END > > GO > > INSERT INTO RUBY_TEST VALUES(20) > ------------------------------------------------ > > > >