Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Identity Crisis Expand / Collapse
Author
Message
Posted Wednesday, October 28, 2009 9:31 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Saturday, July 19, 2014 6:50 AM
Points: 540, Visits: 254
Comments posted to this topic are about the item Identity Crisis
Post #810487
Posted Wednesday, October 28, 2009 10:45 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 8:25 AM
Points: 1,519, Visits: 2,550
Gud question. I had forgotten abt incremental value as I never use it. I always increment identity column with default value.
Post #810504
Posted Thursday, October 29, 2009 12:08 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 5, 2013 6:08 AM
Points: 1,079, Visits: 591
Nice one, realised my mistake after running the qry on management studio.

What you don't know won't hurt you but what you know will make you plan to know better
Post #810520
Posted Thursday, October 29, 2009 2:49 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 3:16 AM
Points: 2,494, Visits: 2,375
San-847017 (10/28/2009)
I always increment identity column with default value.

I used a seed = 1 and an increment of 5 and in another table seed = 2 and an increment of 5. So table A always has last digit = 1 or 6 and table B 2 and 7.
When I reference in table C the two table above, I know thanks to the last digit which table is linked.
Post #810572
Posted Thursday, October 29, 2009 3:56 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, June 26, 2014 7:19 AM
Points: 360, Visits: 63
In your explanation 'According to BOL, "If the table contains an identity column, the counter for that column is reset to the seed value defined for the column. If no seed was defined, the default value 1 is used."' you omit to say that this is for TRUNCATE.
Post #810604
Posted Thursday, October 29, 2009 6:13 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, July 21, 2014 7:44 PM
Points: 817, Visits: 1,646
bah. automatically assumed it was seeded with increments of 1. i've never used a non-1 increment personally :/
Post #810678
Posted Thursday, October 29, 2009 6:39 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, June 4, 2014 12:21 PM
Points: 1,327, Visits: 155
Shoot! I had the identity increment right, but forgot about truncate table resetting the seed value.



Mark
Post #810698
Posted Thursday, October 29, 2009 8:10 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, July 7, 2014 8:58 AM
Points: 645, Visits: 400
kramaswamy (10/29/2009)
bah. automatically assumed it was seeded with increments of 1. i've never used a non-1 increment personally :/

Ditto .
Post #810789
Posted Thursday, October 29, 2009 8:12 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, July 7, 2014 8:58 AM
Points: 645, Visits: 400
Mark Harr (10/29/2009)
Shoot! I had the identity increment right, but forgot about truncate table resetting the seed value.

There was a recent question which brought that point out (maybe Mark missed it ). I appreciate this question's showing an aspect of IDENTITY() with which I wasn't familiar.
Post #810792
Posted Thursday, October 29, 2009 9:27 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, July 17, 2014 10:56 AM
Points: 3,924, Visits: 1,607
Damn. I missed the increment/seed part. Generally we used (1,1) for identity column and its (1,3) in the question.

SQL DBA.
Post #810889
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse