Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Bug Reports (Closed)
 BUG (3.2aX): Archive ID Fields
 Forum Locked  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 03 March 2001 :  18:10:30  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
The ARCHIVE Tables have an ID Field of "ID"... it should be more descriptive like ARCH_T_ID and ARCH_R_ID

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 03 March 2001 :  19:18:43  Show Profile  Visit HuwR's Homepage
to be honest it could be removed, since it isn't actually required for anything

Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 03 March 2001 :  19:34:34  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
it's just good practice to have an ID field for each table.

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 03 March 2001 :  19:42:40  Show Profile  Visit HuwR's Homepage
it can also be a performane issue.

if you create an auto in field in sql and do not create any indexes on the table, the auto id field is the default index, so if you never use the id field in where clauses then it has an adverse affect on you performance

Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 03 March 2001 :  19:52:41  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
I don't fully understand why... but two different DBA's I've talked with on two different issues completely have strongly indicated that it's a good practice.

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 03 March 2001 :  20:02:55  Show Profile  Visit HuwR's Homepage
I think what they were trying to say was that each record in a table should have an ID field (ie a means to distinguish each record in the table as unique) this is not the same as an 'identity' col, which is just a special kind of datatype which aut increments numbers. the archive tables already have this in the reply/topic id.

In fact as a SQL sytem admin and developer, I do not encourage the use of autoinc fields, and generally use either triggers or a function to create ID's



Edited by - huwr on 03 March 2001 20:04:01
Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 03 March 2001 :  21:07:46  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
yesa :) There have been many times I wished we could impliment the ID field incrimentation into the forum code... but then you can't realy have as much control... and requires something like a global.asa

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 03 March 2001 :  21:28:59  Show Profile
quote:
In fact as a SQL sytem admin and developer, I do not encourage the use of autoinc fields, and generally use either triggers or a function to create ID's

You're more a Celko advocate than a Date advocate, I guess. I nearly always use artificial ID's as PK's, probably because of many years working with hierarchial DB's prior to getting into relational DB's.

I don't know if there is a 'right' and 'wrong' way in this regard. There have been spirited debates on the subject for quite a long time. Not quite as hot as the MS-Linux type debates though :)




======
Doug G
======
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 03 March 2001 :  21:35:12  Show Profile  Visit HuwR's Homepage
actually, I have been thinking about this, and it would be fairly simple.

the forum stores it's date as
20010110095939 if you then append to this the usersid, you get a pretty unique number, unless the same person posts again within a second, but you could minimise this risk by getting the id when they enter post.asp, so by the time they have written and posted the message, it is likely to have taken more than 1 sec.

The only difference would be for the user_id you could maybe do this by using a simple application counter which you could lock when incrementing

Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 03 March 2001 :  21:57:31  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
but triggers/auto incriments work much better.. no questions.. no worries.

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 03 March 2001 :  22:18:20  Show Profile  Visit HuwR's Homepage
triggers yes, auto increments quetionable, they generally cause more headaches when coding than they give benefits, in large client server databases using many to many or one to many relationships it is often desirable if not necesary to know the ID of the record you are about to insert, this is not possible using auto increment fields.

Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 04 March 2001 :  16:58:38  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
I'm directly refering to Snitz Forums 2000 here ;)

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page

cevans
Junior Member

Canada
101 Posts

Posted - 05 March 2001 :  06:02:33  Show Profile  Send cevans an ICQ Message
quote:

it is often desirable if not necesary to know the ID of the record you are about to insert, this is not possible using auto increment fields.



Actually, with SQL Server, you can get the (just-inserted) value of an identity column. You need to either do it in the same connection which made the insert (a stored procedure works best). This will return the value aliased as id_value:

select @@identity as id_value


That being said, I fully agree that identity fields are more of a hastle/hindrance than a benefit!


Clark
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 05 March 2001 :  07:37:31  Show Profile  Visit HuwR's Homepage
quote:

quote:

it is often desirable if not necesary to know the ID of the record you are about to insert, this is not possible using auto increment fields.



Actually, with SQL Server, you can get the (just-inserted) value of an identity column. You need to either do it in the same connection which made the insert (a stored procedure works best). This will return the value aliased as id_value:

select @@identity as id_value



Yes but only for MS SQL

quote:

That being said, I fully agree that identity fields are more of a hastle/hindrance than a benefit!



I think we should distinguish here between identity fields and Auto Inc fields, identity fields are essential for referential integrity in large data applications

Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 05 March 2001 :  08:39:22  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
and in an application like SF2K... the auto incriment field is also essential... and is not a cumbersome thing at all... it's actualy a wonderfull thing!

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 05 March 2001 :  10:15:09  Show Profile  Visit HuwR's Homepage
quote:

and in an application like SF2K... the auto incriment field is also essential... and is not a cumbersome thing at all... it's actualy a wonderfull thing!

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a




I would certainly agree with that, any other way would involve compromises on one db or another, this way is simple and makes it reasonable easy acroos different platforms.



Edited by - huwr on 05 March 2001 10:15:36
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 Forum Locked  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000 Version 3.4.07