Re: Maths Formula Question

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 09/28/04


Date: Wed, 29 Sep 2004 00:43:35 +0200

On Tue, 28 Sep 2004 11:12:00 +0100, Ian wrote:

>Hi Hugo
>
>This is a really great idea. but there is triggers on the table that keep
>all the instructions in and incremental order so should I do that then the
>data will just change back before I finish.
>
>The way I am currently doing it is holding the data in a temp table that I
>want duplicated then I do an insert into table and the trigger then only
>fires once.

Hi Ian,

Did you consider getting rid of the trigger and doing all updates to the
table through stored procedures (that incorporate the part of the trigger
logic that's relevant to the operation carried out in the proc).

The reason I suggest this is this: you are basically storing integer data.
But the way you are now planning to perform your inserts forces you to
declare the column as a numeric datatype, as you now need to store
fractions - that will immediately afterwards be replaced by integer data!
Not very efficient.

You'll also have to find out the number of digits needed to the right of
the decimal point to hold seperate values for the maximum number of rows
you'll ever have to insert (and once you defined that maximum, you can
expect a user to try it with just one or two more - Murphy's law always
kicks in in cases like this).

If against all advise you do decide to take this path, just forget about
the complicated formula and use fixed increments (the minimum that the
declared datatype for the column can handle). So if your datatype is
numeric(15,4), your rows "between" 12 and 13 would be numbered 12.0001,
12.0002, 12.0003, ...., and finally 12.0007.

Best, Hugo

-- 
(Remove _NO_ and _SPAM_ to get my e-mail address)


Relevant Pages

  • Re: Maths Formula Question
    ... >all the instructions in and incremental order so should I do that then the ... Did you consider getting rid of the trigger and doing all updates to the ... The reason I suggest this is this: you are basically storing integer data. ... declared datatype for the column can handle). ...
    (microsoft.public.vb.general.discussion)
  • Re: Maths Formula Question
    ... >all the instructions in and incremental order so should I do that then the ... Did you consider getting rid of the trigger and doing all updates to the ... The reason I suggest this is this: you are basically storing integer data. ... declared datatype for the column can handle). ...
    (microsoft.public.vb.enterprise)
  • Re: How to access field contents generically in trigger
    ... You can't have one trigger for all tables. ... I copy all old and new data in the audit ... You put only the first character of the datatype in @ColDataType ... in scope for the dynamic SQL. ...
    (microsoft.public.sqlserver.programming)