Re: Creating my own "identity" type

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

From: David Portas (REMOVE_BEFORE_REPLYING_dportas_at_acm.org)
Date: 06/04/04


Date: Fri, 4 Jun 2004 18:53:51 +0100

The replies weren't really a debate about keys but a response to your
statement that "identity isn't the best solution". Since you didn't specify
what advantage you hope to gain by generating your own surrogate key it's
difficult to recommend a useful solution. You can do it this way, with the
disadvantages already described:

CREATE TABLE SomeTable (x INTEGER PRIMARY KEY, ...)

INSERT INTO SomeTable (x, foo, bar)
    SELECT COALESCE(MAX(x),0)+1, 'abc', 123
        FROM SomeTable

-- 
David Portas
SQL Server MVP
--


Relevant Pages

  • Re: OT: Posts to which Kilgore Trout refuses to respond, part 3
    ... But your response is only 5 kilobytes. ... When you pull up the original debate, ... refuting your false ad hominem assertion. ... propositions you claim can be proven. ...
    (rec.gambling.poker)
  • Re: OT: Posts to which Kilgore Trout refuses to respond, part 2
    ... But your response is only 5 kilobytes. ... When you pull up the original debate, ... refuting your false ad hominem assertion. ... propositions you claim can be proven. ...
    (rec.gambling.poker)
  • Re: Pot arrests up
    ... >> I replied the way I did because my response to Juba was used as an ... I reply directly to Kenny ... >> to Juba. ... You would be amazed how many nasty posts and replies ...
    (alt.support.chronic-pain)
  • Re: What is the best way to process this list
    ... You again pretend to engage in honest debate to troll another response ... | Disagreeing with you is not an attack. ... need to bicker) is the evidence! ...
    (comp.lang.lisp)