Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #162

Re: SSE 2008: Trigger: Modifying Data to be Written

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From "Bob Barrows" <reb01501@NOyahooSPAM.com>
Newsgroups comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming
Subject Re: SSE 2008: Trigger: Modifying Data to be Written
Date Mon, 11 Apr 2011 14:55:38 -0400
Organization A noiseless patient Spider
Lines 39
Message-ID <inviv0$588$1@dont-email.me> (permalink)
References <ab1vp6pks4qspe0bomof4pcnibgbpu8g10@4ax.com> <ino33e$1rk$1@dont-email.me> <p16vp6545phoh2i1ag0s2apt53guue997h@4ax.com> <Xns9EC273A5FD7A3Yazorman@127.0.0.1> <s9c2q6db63sck7oq2cn3au9bmlqs2lr83m@4ax.com> <ins9ba$e16$1@dont-email.me> <snb6q69jo8i45jmmjaaedjmmii4fgkan64@4ax.com>
Injection-Date Mon, 11 Apr 2011 18:57:36 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="NUmboHSNYG4cX5Ys9j8TNw"; logging-data="5384"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Q1D9Cszc9B1xEIquzVdZTylX7WPF+JdE="
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2800.2001
X-Antivirus-Status Clean
X-Newsreader Microsoft Outlook Express 6.00.2800.2001
X-Antivirus avast! (VPS 110411-0, 04/11/2011), Outbound message
Cancel-Lock sha1:dr0FW948Fp1g9DawB9tjjUurVMo=
X-Priority 3
X-MSMail-Priority Normal
Xref x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:162

Cross-posted to 2 groups.

Show key headers only | View raw


Gene Wirchenko wrote:
> On Sun, 10 Apr 2011 08:54:48 -0400, "Bob Barrows"
> <reb01501@NOSPAMyahoo.com> wrote:
>
>> Gene Wirchenko wrote:
>>>>  2) I think that maintainability was covered by the code I borrowed
>>> from.  My derivative has
>>>          select * into #Inserted from Inserted
>>> at the beginning and then at the end, writes with
>>>          insert into Accounts select * from #Inserted
>
>> You consider this to be a good idea? Despite the number of experts
>> in the field that advise against using selstar (select *)? I won't
>> repeat that advice here: it's very easily found. I will say that I
>> have never seen an expert recommend its use.
>
>      Saying that something never has a valid use is a very broad
> statement.  It would be very easy for someone, even an expert, to miss
> edge cases where it would be a good idea.
>
>      This is definitely a case where one wants all columns.  Why make
> maintenance that much more difficult by insisting on listing all of
> the columns explicitly?
>
It is not a matter of wanting all the columns. It is a matter of writing
maintainable code that will not blow up just because a new column is added.
I disagree that listing all the columns makes code less maintainable.

An example where using selstar caused one of my colleagues to spend an
afternoon trying to fix a "bug" in his application occurred when he created
a view that used it, never expecting that he would have to recompile the
view to get it to return columns added after the initial compilation.

I've tested a trigger that uses selstar to select into a test table and it
does seem to behave as you want it to behave, not needing a recompile after
adding a column to the trigger table, so it should work as you desire
providing you solve the other problems Erland pointed out..

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

SSE 2008: Trigger: Modifying Data to be Written Gene Wirchenko <genew@ocis.net> - 2011-04-08 15:11 -0700
  Re: SSE 2008: Trigger: Modifying Data to be Written "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2011-04-08 18:44 -0400
    Re: SSE 2008: Trigger: Modifying Data to be Written Gene Wirchenko <genew@ocis.net> - 2011-04-08 16:23 -0700
      Re: SSE 2008: Trigger: Modifying Data to be Written Erland Sommarskog <esquel@sommarskog.se> - 2011-04-09 11:22 +0200
        Re: SSE 2008: Trigger: Modifying Data to be Written Gene Wirchenko <genew@ocis.net> - 2011-04-09 21:29 -0700
          Re: SSE 2008: Trigger: Modifying Data to be Written Erland Sommarskog <esquel@sommarskog.se> - 2011-04-10 14:48 +0200
            Re: SSE 2008: Trigger: Modifying Data to be Written Gene Wirchenko <genew@ocis.net> - 2011-04-11 09:46 -0700
          Re: SSE 2008: Trigger: Modifying Data to be Written "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2011-04-10 08:54 -0400
            Re: SSE 2008: Trigger: Modifying Data to be Written Erland Sommarskog <esquel@sommarskog.se> - 2011-04-10 21:33 +0200
            Re: SSE 2008: Trigger: Modifying Data to be Written Gene Wirchenko <genew@ocis.net> - 2011-04-11 09:42 -0700
              Re: SSE 2008: Trigger: Modifying Data to be Written "Bob Barrows" <reb01501@NOyahooSPAM.com> - 2011-04-11 14:55 -0400
                Re: SSE 2008: Trigger: Modifying Data to be Written Gene Wirchenko <genew@ocis.net> - 2011-04-11 14:53 -0700
                Re: SSE 2008: Trigger: Modifying Data to be Written "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2011-04-11 18:49 -0400

csiph-web