how to erase a id table in sql server
hi,
i creating a aplication with sql server database and now i want distribute the aplication with the database that i created but i have registered some records to test the program and now i want reset the id for start again from 0
there is any way to do that?
and there is any program to generate a sql batch to creat the database too?
thanks for your help
bruno
Re: how to erase a id table in sql server
From the SQL help (books online - BOL)...
Quote:
The following example forces the current identity value in the Employee table in the AdventureWorks database to a value of 30.
USE AdventureWorks;
GO
DBCC CHECKIDENT ('HumanResources.Employee', RESEED, 30)
GO
Creating the database from a script is a bit harder - first is this MS SQL Express or MS SQL 2000 or 2005??
Re: how to erase a id table in sql server
hi,
i using sql server 2000 i will try the code that you say
thanks for your help
bruno
Re: how to erase a id table in sql server
Truncate Table also resets Identity columns but has some restrictions. You cannot execute Truncate Table if the table is being used in a relationship (ie foreign keys).