Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Autoinc's & GUID's
Thu, Sep 19 2013 9:28 PMPermanent Link

Adam H.

Hi,

Just throwing a question out there regarding Autoinc's and GUID's. At
preent I have GUID's in my application. They work extremely well. The
main advantage I have with them is to use one field in one table to link
to records in multiple tables knowing that there will never be a record
(regardless of the table) with the same unique identifier.

(ie, If I have a transaction table, I can have a field called Contract,
and link this to either a purchase contract or sales contract record
even though I have separate tables for purchase & sales contracts,
knowing that it's a unique record, so it will only link where applicable)

The only issue I have with GUID's is that because my application has so
many lookup fields - every record takes up a number of bytes and thus
makes the data quite large. (Backups, etc)

However if I was to use Autoinc fields, I probably couldn't do what I'm
doing, and would require separate fields.

I was wondering would it be bad practise to use Autoinc fields, but say
start the sales contracts at some very large number (ie, 100,000,000)
and the purchase contracts at 1, knowing that the database will never
end up having the same number for both a purchase contract and a sales
contract? Would this be acceptable?

I can't change my current application, but I'm just thinking out load
for future applications.

Best Regards

Adam.
Fri, Sep 20 2013 3:43 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Adam


>I was wondering would it be bad practise to use Autoinc fields, but say
>start the sales contracts at some very large number (ie, 100,000,000)
>and the purchase contracts at 1, knowing that the database will never
>end up having the same number for both a purchase contract and a sales
>contract? Would this be acceptable?

Or you could have an extra 1 byte column with S or P in it and use a two column link.

Roy Lambert [Team Elevate]
Mon, Sep 23 2013 1:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< I was wondering would it be bad practise to use Autoinc fields, but say
start the sales contracts at some very large number (ie, 100,000,000) and
the purchase contracts at 1, knowing that the database will never end up
having the same number for both a purchase contract and a sales contract?
Would this be acceptable? >>

Sure, as long as you were positive that you wouldn't have any conflicts.
Ranges are used with replication sometimes to isolate autoinc/identity
values between disparate locations.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Sep 24 2013 12:33 AMPermanent Link

Adam H.

Hi Roy,

> Or you could have an extra 1 byte column with S or P in it and use a two column link.

Thanks. That is another idea. I guess I'm wanting to keep as simple as
possible (and have always liked the current GUID where I don't have to
care about such matters just do a join and forget Wink)

Cheers

Adam.
Tue, Sep 24 2013 12:35 AMPermanent Link

Adam H.

Hi Tim,

> Sure, as long as you were positive that you wouldn't have any conflicts.
> Ranges are used with replication sometimes to isolate autoinc/identity
> values between disparate locations.

Thanks for that. Gives me an idea of what I might be able to do in the
future!

Best Regards

Adam.
Image