Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #948
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
|---|---|
| From | Johnnyb <john.lutheran@gmail.com> |
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Re: Trigger help |
| Date | Mon, 2 Apr 2012 15:04:45 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 30 |
| Message-ID | <19161780.71.1333404285072.JavaMail.geo-discussion-forums@pbcql6> (permalink) |
| References | <11931752.1474.1333025246004.JavaMail.geo-discussion-forums@pbjv6> <XnsA029F1A89853BYazorman@127.0.0.1> |
| NNTP-Posting-Host | 134.253.26.10 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1333404285 30858 127.0.0.1 (2 Apr 2012 22:04:45 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Mon, 2 Apr 2012 22:04:45 +0000 (UTC) |
| In-Reply-To | <XnsA029F1A89853BYazorman@127.0.0.1> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=134.253.26.10; posting-account=kYW--QoAAABRuO6dTOz2QITtLsB-PRVZ |
| User-Agent | G2/1.0 |
| Xref | csiph.com comp.databases.ms-sqlserver:948 |
Show key headers only | View raw
OK, I am a total novice, it is the 'Do Something Here' part I am stuck on. I want to copy just the row into s different database on a different server. On Monday, April 2, 2012 3:45:21 PM UTC-6, Erland Sommarskog wrote: > Johnnyb (john.lutheran@gmail.com) writes: > > I need to create a trigger that will fire when particular text shows up > > in a particular column. Then I need to copy that row to another table. > > Not sure how to do this. Any help would be greatly appreciated. > > CREATE TRIGGER tri ON tbl AFTER INSERT, UPDATE AS > IF EXISTS (SELECT * > FROM inserted > WHERE col LIKE '%particular text%') > BEGIN > -- Do something here. > END > > > inserted holds the inserted rows, or in case of an UDPATE statement, the > updated rows after the UPDATE. > > Don't forget to consider what should happen if the text appears both > before and after the update. > > -- > Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se > > Links for SQL Server Books Online: > SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx > SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
Trigger help Johnnyb <john.lutheran@gmail.com> - 2012-03-29 05:47 -0700
Re: Trigger help Johnnyb <john.lutheran@gmail.com> - 2012-03-30 07:35 -0700
Re: Trigger help bradbury9 <ray.bradbury9@gmail.com> - 2012-03-29 15:46 -0700
Re: Trigger help Erland Sommarskog <esquel@sommarskog.se> - 2012-04-02 23:45 +0200
Re: Trigger help Johnnyb <john.lutheran@gmail.com> - 2012-04-02 15:04 -0700
Re: Trigger help Erland Sommarskog <esquel@sommarskog.se> - 2012-04-03 07:33 +0000
Re: Trigger help Gene Wirchenko <genew@ocis.net> - 2012-04-02 20:52 -0700
Re: Trigger help Erland Sommarskog <esquel@sommarskog.se> - 2012-04-03 07:26 +0000
Re: Trigger help Johnnyb <john.lutheran@gmail.com> - 2012-04-03 05:03 -0700
Re: Trigger help Gene Wirchenko <genew@ocis.net> - 2012-04-03 08:17 -0700
Re: Trigger help Johnnyb <john.lutheran@gmail.com> - 2012-04-04 07:05 -0700
Re: Trigger help Erland Sommarskog <esquel@sommarskog.se> - 2012-04-04 23:45 +0200
Re: Trigger help Gene Wirchenko <genew@ocis.net> - 2012-04-04 14:58 -0700
Re: Trigger help Erland Sommarskog <esquel@sommarskog.se> - 2012-04-05 09:08 +0200
Re: Trigger help Johnnyb <john.lutheran@gmail.com> - 2012-04-05 06:06 -0700
Re: Trigger help Gene Wirchenko <genew@ocis.net> - 2012-04-05 08:24 -0700
Re: Trigger help Erland Sommarskog <esquel@sommarskog.se> - 2012-04-05 23:51 +0200
Re: Trigger help Gene Wirchenko <genew@ocis.net> - 2012-04-05 08:19 -0700
csiph-web