Re: Creating my own "identity" type
From: David Portas (REMOVE_BEFORE_REPLYING_dportas_at_acm.org)
Date: 06/04/04
- Next message: Zoury: "soundex and difference"
- Previous message: dw: "Re: Horizontal to vertical with distinct"
- In reply to: Josh Golden: "Re: Creating my own "identity" type"
- Next in thread: Louis Davidson: "Re: Creating my own "identity" type"
- Reply: Louis Davidson: "Re: Creating my own "identity" type"
- Messages sorted by: [ date ] [ thread ]
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 --
- Next message: Zoury: "soundex and difference"
- Previous message: dw: "Re: Horizontal to vertical with distinct"
- In reply to: Josh Golden: "Re: Creating my own "identity" type"
- Next in thread: Louis Davidson: "Re: Creating my own "identity" type"
- Reply: Louis Davidson: "Re: Creating my own "identity" type"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|