Re: Logging deletes...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Chris Marsh (cmarsh_at_synergy-intl.com)
Date: 11/12/04


Date: Fri, 12 Nov 2004 18:51:42 -0500

Hugo, what am I missing? This doesn't appear to be working and here is what
I get once I add the getdate() value to the select line:

Error 121: The select list of the INSERT statement contains more items than
the insert list. The number of SELECT values must match the number of
INSERT columns.

Thanks,

Chris

"Hugo Kornelis" <hugo@pe_NO_rFact.in_SPAM_fo> wrote in message
news:37gap0dqsd4et5bss3c8fjguu86ltqdgs3@4ax.com...
> On Fri, 12 Nov 2004 12:43:18 -0500, Chris Marsh wrote:
>
>>I am confident that if I get one of those values to update then I can add
>>the addtional values as well. Here is my current trigger:
>
> Hi Chris,
>
> You need a small change to the syntax:
>
> CREATE TRIGGER [SaveDeletedCustomer] ON [dbo].[customer]
> INSTEAD OF DELETE -- Must use INSTEAD OF as the customer table has many
> Text columns.
> AS
>
> INSERT INTO delcustomer (cusid, ..., del_datetime, del_user, del_host)
> SELECT cusid, ..., getdate(), suser_sname(), host_name()
> FROM deleted
>
> DELETE customer
> FROM deleted
> WHERE customer.cusid = deleted.cusid
>
> (untested)
>
> Best, Hugo
> --
>
> (Remove _NO_ and _SPAM_ to get my e-mail address)



Relevant Pages

  • Re: Logging deletes...
    ... found my mistake. ... This solution is perfect for my clients now I need to ... >>Hugo, what am I missing? ... > Hi Chris, ...
    (microsoft.public.sqlserver.programming)
  • Re: Encoding materialized path in an atomic value.
    ... > David Cressey wrote: ... >>> Maybe I'm missing something here? ... >>> Best, Hugo ... but a hierachy of ancestor slots. ...
    (comp.databases.theory)
  • Re: Robert Sawyer: Why?
    ... >> by his recent Hugo? ... Am I missing something? ... >o/~ Blame Canada! ... He completely bounced Spider Robinson as the guy Canadian networks turn ...
    (rec.arts.sf.written)
  • Re: So famous I dont know you
    ... Obviously I'm missing something; but what? ... You are missing the *other* Richard A. Lupoff ISFDB entry at ... was popular and won the Hugo award back in 1963 and his first critical ... His fiction was moderately popular in the mid-1970s (a few ...
    (rec.arts.sf.written)
  • Re: Check input
    ... On Thu, 10 Apr 2003 at 15:41 GMT, Hugo wrote: ... My code in this post is copyright 2003, Chris F.A. Johnson ... and may be copied under the terms of the GNU General Public License ...
    (comp.unix.shell)