Primary key Identity begin again 
Author Message
 Primary key Identity begin again
hi there:

I work with sql server and in my tables the primary keys are smallint
type and is Identity. I went to the record 32767 in the table, but
some of the record are deleted and i want to return to the first
primery key and know if it is in use to keep it or it was deleted to
reused.

if i dont explain my problem at all, ask me for more details.

Thanks



Sun, 18 Jul 2004 19:37:56 GMT
 Primary key Identity begin again

Hi,

I do not think this is a good idea. You will need to make
some kind of looping to define if it is deleted or not.
Result - BAD performance. Aslo, by default, you cannot
insert identity. You have to use SET IDENTITY_INSERT ON to
allow explicit inserting of identity values. In that case
you could lose control over values. I think best solution
in your case is to change data type of your column to INT.

Val

Quote:
>-----Original Message-----
>hi there:

>I work with sql server and in my tables the primary keys
are smallint
>type and is Identity. I went to the record 32767 in the
table, but
>some of the record are deleted and i want to return to
the first
>primery key and know if it is in use to keep it or it was
deleted to
>reused.

>if i dont explain my problem at all, ask me for more
details.

>Thanks
>.



Sun, 18 Jul 2004 21:36:40 GMT
 Primary key Identity begin again


Quote:
>SET IDENTITY_INSERT ON t

thnaks but i dony want that at all.

Can i do it in a trigger? and if it is posible, can you tell me how?



Mon, 19 Jul 2004 22:21:45 GMT
 Primary key Identity begin again
Hi,

It does not matter in trigger or not, anyway if you want
to insert already previously used identity values, then
you have to use SET IDENTITY_INSERT ON. If not, then you
have to change data type of field to INT. I think it would
be better solution, because it will involve small or none
changes in code, depending on how application was designed

Val

Quote:
>-----Original Message-----
>On Wed, 30 Jan 2002 05:36:40 -0800, "Val Mazur"


Quote:

>>SET IDENTITY_INSERT ON t
>thnaks but i dony want that at all.

>Can i do it in a trigger? and if it is posible, can you
tell me how?
>.



Tue, 20 Jul 2004 02:23:41 GMT
 Primary key Identity begin again
I think that is a good idea.
i will change the fields type to int, cause in other way it will be
very hard to do it.

Thanks for your time.
See ya
Pablo



Quote:
>Hi,

>It does not matter in trigger or not, anyway if you want
>to insert already previously used identity values, then
>you have to use SET IDENTITY_INSERT ON. If not, then you
>have to change data type of field to INT. I think it would
>be better solution, because it will involve small or none
>changes in code, depending on how application was designed

>Val

>>-----Original Message-----
>>On Wed, 30 Jan 2002 05:36:40 -0800, "Val Mazur"


>>>SET IDENTITY_INSERT ON t
>>thnaks but i dony want that at all.

>>Can i do it in a trigger? and if it is posible, can you
>tell me how?
>>.



Tue, 20 Jul 2004 20:36:56 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. update primary key [aid] to identity(300,1) Primary key

2. DB Design: identity column as primary key and join key

3. DB Design: identity column as primary key and join key

4. Numeric Primary Key vs. Combination Primary Key

5. Diff between Primary key and non primary key select

6. Joined Primary Key in Foxpro (Make 1 Primary Key from 2 fields)

7. Composite Primary key or 1 primary key column with all values

8. Primary key or no primary key

9. Composite Primary key or 1 primary key column with all values


 
Powered by phpBB® Forum Software