Click here to Skip to main content
15,914,163 members
Home / Discussions / Database
   

Database

 
GeneralLaunching SQL Server job xp_cmdshell Pin
devvvy29-Mar-05 17:32
devvvy29-Mar-05 17:32 
GeneralOracleClient and Timestamp datatype Pin
Yos Nugroho29-Mar-05 17:21
Yos Nugroho29-Mar-05 17:21 
GeneralGUIDs as PK's Pin
Marc Clifton29-Mar-05 10:04
mvaMarc Clifton29-Mar-05 10:04 
GeneralRe: GUIDs as PK's Pin
rwestgraham29-Mar-05 10:25
rwestgraham29-Mar-05 10:25 
GeneralRe: GUIDs as PK's Pin
Carl Mercier1-Apr-05 10:24
Carl Mercier1-Apr-05 10:24 
GeneralRe: GUIDs as PK's Pin
Marc Clifton4-Apr-05 5:16
mvaMarc Clifton4-Apr-05 5:16 
GeneralRe: GUIDs as PK's Pin
Andy Brummer29-Mar-05 11:14
sitebuilderAndy Brummer29-Mar-05 11:14 
GeneralRe: GUIDs as PK's Pin
turbochimp29-Mar-05 19:19
turbochimp29-Mar-05 19:19 
Yes. I've done it both ways, and I definitely prefer using unique IDs to sequences/identity columns.

The reasons have been pretty well covered here. There are some minor drawbacks, such as making visual inspection of the data a little more difficult (e.g. you're trying to glance at a small sample of data to get an idea of how related records hang together), and it takes a little getting used to in that respect, but the benefits outweigh the aggravations for me.

The value of using a guaranteed "unique" id was underscored for me recently while I was working on a project using Oracle, which has no Guid type intrinsically. The designers had established sequences and insert triggers to keep the sequences incrementing however, after some 50,000 rows of data or so, one of the sequences got dropped and recreated with an arbitrary seed value lower than the highest previous sequence value. That was bad enough; what made it worse was that the code responsible for inserting rows into the affected table did not differentiate between inserts and updates. The method was passed a PK value (integer), which in the case of new records was the next value in the sequence, and for existing records was their current PK value. The logic was similar to:

1. Does that sequence value exist in the database?
2. If step 1 is False, insert a new record (correct behavior at all times)
3. If step 1 is True, update the record with the provided PK value with all of the data provided (this was a killer, since the renumbered sequence was now sometimes providing "used" PK values for new records, overwriting entire records inadvertently - it was even harder to locate the problem since deletions made "holes" in the tables PK range, so sometimes new records with out-of-sequence PKs would insert just fine).

Guids are goooood.

Hope this helps.

The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

GeneralRe: GUIDs as PK's Pin
Scott Serl30-Mar-05 13:58
Scott Serl30-Mar-05 13:58 
GeneralRe: GUIDs as PK's Pin
Michael P Butler31-Mar-05 6:24
Michael P Butler31-Mar-05 6:24 
GeneralRe: GUIDs as PK's Pin
Michael Potter1-Apr-05 4:56
Michael Potter1-Apr-05 4:56 
GeneralRe: GUIDs as PK's Pin
Carl Mercier1-Apr-05 10:27
Carl Mercier1-Apr-05 10:27 
Questionhow to find server name of oracle Pin
satishrg29-Mar-05 8:55
satishrg29-Mar-05 8:55 
AnswerRe: how to find server name of oracle Pin
Colin Angus Mackay29-Mar-05 11:00
Colin Angus Mackay29-Mar-05 11:00 
AnswerRe: how to find server name of oracle Pin
Andy Brummer29-Mar-05 11:30
sitebuilderAndy Brummer29-Mar-05 11:30 
GeneralPermissions Pin
vuthaianh28-Mar-05 17:50
vuthaianh28-Mar-05 17:50 
GeneralRe: Permissions Pin
Edbert P28-Mar-05 20:11
Edbert P28-Mar-05 20:11 
QuestionWhat kind of Errors the SELECT statement can raise?? Pin
_J_28-Mar-05 10:51
_J_28-Mar-05 10:51 
AnswerRe: What kind of Errors the SELECT statement can raise?? Pin
Colin Angus Mackay29-Mar-05 0:57
Colin Angus Mackay29-Mar-05 0:57 
GeneralRe: What kind of Errors the SELECT statement can raise?? Pin
_J_29-Mar-05 1:09
_J_29-Mar-05 1:09 
GeneralRe: What kind of Errors the SELECT statement can raise?? Pin
Colin Angus Mackay29-Mar-05 1:32
Colin Angus Mackay29-Mar-05 1:32 
GeneralRe: What kind of Errors the SELECT statement can raise?? Pin
_J_29-Mar-05 1:44
_J_29-Mar-05 1:44 
GeneralRe: What kind of Errors the SELECT statement can raise?? Pin
Colin Angus Mackay29-Mar-05 1:53
Colin Angus Mackay29-Mar-05 1:53 
GeneralRe: What kind of Errors the SELECT statement can raise?? Pin
_J_29-Mar-05 1:57
_J_29-Mar-05 1:57 
GeneralRe: What kind of Errors the SELECT statement can raise?? Pin
Colin Angus Mackay29-Mar-05 11:01
Colin Angus Mackay29-Mar-05 11:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.