Subject | RE: [firebird-support] reset autoincrement field |
---|---|
Author | Zoran |
Post date | 2016-12-02T15:47:18Z |
IDENTITY in FB3 uses the same logic as previous versions (trigger and
generator), only it is hidden from the user. Behind the scenes it is doing
that.
If you don't find the better solution, here is how you can get generator
name for the Primary Key (IDENTITY):
(change CUSTOMER to your table name)
SELECT g.RDB$GENERATOR_NAME
FROM RDB$RELATION_FIELDS AS g
WHERE g.RDB$RELATION_NAME = 'CUSTOMER'
AND g.RDB$FIELD_NAME = (SELECT f.rdb$field_name
FROM rdb$index_segments AS f
LEFT JOIN rdb$relation_constraints AS rc ON
(rc.rdb$index_name = f.rdb$index_name)
WHERE rc.rdb$relation_name = 'CUSTOMER'
AND rc.rdb$constraint_type = 'PRIMARY KEY')
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com]
Sent: Friday, December 2, 2016 10:37 AM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] reset autoincrement field
I only use the property Identity to make an autoincrement field and I don't
make use of generators. Therefore 'How can I reset an autoincrement field in
firebird 3 ? I used identity to make an autoincrement field' ?
Nico Speleers
Analyst
Carfac bvba
Driving on experience
Rijksweg 53
9680 Maarkedal
Tel. +32 55 23 00 00
Fax +32 55 31 00 95
nico.speleers@...
www.carfac.be<http://www.carfac.be/>
[cid:image001.jpg@01D11613.C23F19C0]<http://www.facebook.com/groups/12070918
1286476/>[cid:image002.jpg@01D11613.C23F19C0]<http://www.linkedin.com/compan
y/hdc-software-nv> [cid:image003.jpg@01D11613.C23F19C0]
<https://twitter.com/carfacbvba>
[Beschrijving: Beschrijving: Beschrijving: CarfacAS
(klein)]<http://www.carfac.be/>
Van: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com]
Verzonden: vrijdag 2 december 2016 16:34
Aan: firebird-support@yahoogroups.com
Onderwerp: RE: [firebird-support] reset autoincrement field
To see current generator value
select gen_id(generator-name, 0) from rdb$database
To set generator value
set generator generator-name to value;
From:
firebird-support@yahoogroups.com<mailto:firebird-support@yahoogroups.com>
[mailto:firebird-support@yahoogroups.com]
Sent: Friday, December 2, 2016 10:13 AM
To:
firebird-support@yahoogroups.com<mailto:firebird-support@yahoogroups.com>
Subject: [firebird-support] reset autoincrement field
How can I reset an autoincrement field in firebird 3 ? I used identity to
make an autoincrement field.
Thanks.
Nico Speleers
Analyst
Carfac bvba
Driving on experience
Rijksweg 53
9680 Maarkedal
Tel. +32 55 23 00 00
Fax +32 55 31 00 95
nico.speleers@...<mailto:nico.speleers@...>
www.carfac.be<http://www.carfac.be/<http://www.carfac.be%3chttp:/www.carfac.
be/>>
[cid:image001.jpg@01D11613.C23F19C0]<http://www.facebook.com/groups/12070918
1286476/>[cid:image002.jpg@01D11613.C23F19C0]<http://www.linkedin.com/compan
y/hdc-software-nv> [cid:image003.jpg@01D11613.C23F19C0]
<https://twitter.com/carfacbvba>
[Beschrijving: Beschrijving: Beschrijving: CarfacAS
(klein)]<http://www.carfac.be/>
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
generator), only it is hidden from the user. Behind the scenes it is doing
that.
If you don't find the better solution, here is how you can get generator
name for the Primary Key (IDENTITY):
(change CUSTOMER to your table name)
SELECT g.RDB$GENERATOR_NAME
FROM RDB$RELATION_FIELDS AS g
WHERE g.RDB$RELATION_NAME = 'CUSTOMER'
AND g.RDB$FIELD_NAME = (SELECT f.rdb$field_name
FROM rdb$index_segments AS f
LEFT JOIN rdb$relation_constraints AS rc ON
(rc.rdb$index_name = f.rdb$index_name)
WHERE rc.rdb$relation_name = 'CUSTOMER'
AND rc.rdb$constraint_type = 'PRIMARY KEY')
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com]
Sent: Friday, December 2, 2016 10:37 AM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] reset autoincrement field
I only use the property Identity to make an autoincrement field and I don't
make use of generators. Therefore 'How can I reset an autoincrement field in
firebird 3 ? I used identity to make an autoincrement field' ?
Nico Speleers
Analyst
Carfac bvba
Driving on experience
Rijksweg 53
9680 Maarkedal
Tel. +32 55 23 00 00
Fax +32 55 31 00 95
nico.speleers@...
www.carfac.be<http://www.carfac.be/>
[cid:image001.jpg@01D11613.C23F19C0]<http://www.facebook.com/groups/12070918
1286476/>[cid:image002.jpg@01D11613.C23F19C0]<http://www.linkedin.com/compan
y/hdc-software-nv> [cid:image003.jpg@01D11613.C23F19C0]
<https://twitter.com/carfacbvba>
[Beschrijving: Beschrijving: Beschrijving: CarfacAS
(klein)]<http://www.carfac.be/>
Van: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com]
Verzonden: vrijdag 2 december 2016 16:34
Aan: firebird-support@yahoogroups.com
Onderwerp: RE: [firebird-support] reset autoincrement field
To see current generator value
select gen_id(generator-name, 0) from rdb$database
To set generator value
set generator generator-name to value;
From:
firebird-support@yahoogroups.com<mailto:firebird-support@yahoogroups.com>
[mailto:firebird-support@yahoogroups.com]
Sent: Friday, December 2, 2016 10:13 AM
To:
firebird-support@yahoogroups.com<mailto:firebird-support@yahoogroups.com>
Subject: [firebird-support] reset autoincrement field
How can I reset an autoincrement field in firebird 3 ? I used identity to
make an autoincrement field.
Thanks.
Nico Speleers
Analyst
Carfac bvba
Driving on experience
Rijksweg 53
9680 Maarkedal
Tel. +32 55 23 00 00
Fax +32 55 31 00 95
nico.speleers@...<mailto:nico.speleers@...>
www.carfac.be<http://www.carfac.be/<http://www.carfac.be%3chttp:/www.carfac.
be/>>
[cid:image001.jpg@01D11613.C23F19C0]<http://www.facebook.com/groups/12070918
1286476/>[cid:image002.jpg@01D11613.C23F19C0]<http://www.linkedin.com/compan
y/hdc-software-nv> [cid:image003.jpg@01D11613.C23F19C0]
<https://twitter.com/carfacbvba>
[Beschrijving: Beschrijving: Beschrijving: CarfacAS
(klein)]<http://www.carfac.be/>
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]