October 28, 2009 at 9:31 pm
Comments posted to this topic are about the item Identity Crisis
October 28, 2009 at 10:45 pm
Gud question. I had forgotten abt incremental value as I never use it. I always increment identity column with default value.
October 29, 2009 at 12:08 am
Nice one, realised my mistake after running the qry on management studio.
October 29, 2009 at 2:49 am
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.
October 29, 2009 at 3:56 am
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.
October 29, 2009 at 6:13 am
bah. automatically assumed it was seeded with increments of 1. i've never used a non-1 increment personally :/
October 29, 2009 at 6:39 am
Shoot! I had the identity increment right, but forgot about truncate table resetting the seed value.
Mark
October 29, 2009 at 8:10 am
kramaswamy (10/29/2009)
bah. automatically assumed it was seeded with increments of 1. i've never used a non-1 increment personally :/
Ditto :-).
October 29, 2009 at 8:12 am
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.
October 29, 2009 at 9:27 am
Damn. I missed the increment/seed part. Generally we used (1,1) for identity column and its (1,3) in the question.
SQL DBA.
October 29, 2009 at 10:26 am
I have added the truncate item to the explanation.
October 29, 2009 at 12:09 pm
SanjayAttray (10/29/2009)
Damn. I missed the increment/seed part. Generally we used (1,1) for identity column and its (1,3) in the question.
That hit me, too...:angry:
October 30, 2009 at 5:54 am
Damn, I knew how this would work, and noticed the increment 3 too. My mind kinda' swapped the DELETE and TRUNCATE. Chose 4.
October 30, 2009 at 7:59 am
VM-723206 (10/30/2009)
Damn, I knew how this would work, and noticed the increment 3 too. My mind kinda' swapped the DELETE and TRUNCATE. Chose 4.
Welcome to the party. Not as easy as 1 2 3 ...
November 4, 2009 at 2:37 am
What is the Difference between Truncate Table and Delete Table
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply