Can you run an alter table script to change the seed on a table or do you
have to redefine the table DDL?
I want the seed to be 0 instead of 1Check for the DBCC CHECKIDENT in BOL and see if it helps.
MC
"marcmc" <marcmc@.discussions.microsoft.com> wrote in message
news:E7B08050-BD84-4AD1-8E4C-D3C6192C39B7@.microsoft.com...
> Can you run an alter table script to change the seed on a table or do you
> have to redefine the table DDL?
> I want the seed to be 0 instead of 1|||thanks MC but I want to cheange the seed not the identity
Can I update the INFORMATION_SCHEMA.TABLES Seed value'|||Itried this but that aint gunna work.
Any other ideas?
SELECT TABLE_NAME, IDENT_SEED(TABLE_NAME) AS IDENT_SEED, *
FROM INFORMATION_SCHEMA.TABLES
WHERE IDENT_SEED(TABLE_NAME) IS NOT NULL
and TABLE_NAME in ('Pot_lu_rd_county')
update INFORMATION_SCHEMA.TABLES
set IDENT_SEED(TABLE_NAME) = 0
WHERE IDENT_SEED(TABLE_NAME) IS NOT NULL and TABLE_NAME in
('Pot_lu_rd_county')|||You can change the seed value by using DBCC CHECKIDENT (table, reseed, new
seed value) options. Perhaps I misunderstood something?
MC
"marcmc" <marcmc@.discussions.microsoft.com> wrote in message
news:8D21B11D-46D9-46B0-B397-843015B31F86@.microsoft.com...
> Itried this but that aint gunna work.
> Any other ideas?
> SELECT TABLE_NAME, IDENT_SEED(TABLE_NAME) AS IDENT_SEED, *
> FROM INFORMATION_SCHEMA.TABLES
> WHERE IDENT_SEED(TABLE_NAME) IS NOT NULL
> and TABLE_NAME in ('Pot_lu_rd_county')
> update INFORMATION_SCHEMA.TABLES
> set IDENT_SEED(TABLE_NAME) = 0
> WHERE IDENT_SEED(TABLE_NAME) IS NOT NULL and TABLE_NAME in
> ('Pot_lu_rd_county')|||marcmc wrote on Thu, 13 Apr 2006 04:52:01 -0700:
> thanks MC but I want to cheange the seed not the identity
DBCC CHECKINDENT is for changing the seed. Read the description again. The
seed is the value to be used for the first row if the table is empty, or the
next value to use -1 if the table has rows (ie. if you set the seed to 10
and the table has a row in it already, the next new row will be given the
value 11 for the identity)
Or do you mean you want to change the increment?
Dan|||Hi,
I copied the contents of the table to a temp table and ran
DBCC CHECKIDENT ('Pot_lu_rd_county', reseed, 0)
sp_help still says the seed is 1
and populated the table again. The first id is still 1.
I want the tables first id to be 0|||There doesn't seem to be a way apart from dropping the table & redefining th
e
ddl with the following'
IDENTITY (0, 1)|||Did you try setting the seed to -1
"marcmc" <marcmc@.discussions.microsoft.com> wrote in message
news:6BDD2FF5-0619-4EE4-86AB-BB8C3F80A4E6@.microsoft.com...
> Hi,
> I copied the contents of the table to a temp table and ran
> DBCC CHECKIDENT ('Pot_lu_rd_county', reseed, 0)
> sp_help still says the seed is 1
> and populated the table again. The first id is still 1.
> I want the tables first id to be 0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment