|
-
May 28th, 2007, 05:15 AM
#1
Thread Starter
Lively Member
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
-
May 28th, 2007, 08:22 AM
#2
Re: how to erase a id table in sql server
From the SQL help (books online - BOL)...
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??
-
May 28th, 2007, 08:31 AM
#3
Thread Starter
Lively Member
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
-
May 28th, 2007, 10:30 AM
#4
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).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|