Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 07, 2012 04:53 AM by pradeep sharma
Member
157 Points
216 Posts
Nov 07, 2012 01:11 AM|LINK
protected void btnRemove_Click(object sender, EventArgs e) { DBCC CHECKIDENT(AdminLogIn, RESEED, 0); }
----------------------------------------------------------- Coding is not working
Expected ; or = (cannot specify constructor arguments in declaration) is there
Contributor
3970 Points
1096 Posts
Nov 07, 2012 02:03 AM|LINK
As long as your primary key does it's job, what difference does it make whether it starts at 1 or 1000000?
2137 Points
487 Posts
Nov 07, 2012 02:11 AM|LINK
Hi,
First delete the data from table and try.
dbcc checkident('table_name', reseed, 0);
You can ref. below post as well.
http://stackoverflow.com/questions/764004/reset-primary-key
4004 Points
763 Posts
Nov 07, 2012 03:35 AM|LINK
there r two option
1. delete all records from the table and use dbcc to reset
2. truncate the table it will reset
Nov 07, 2012 04:25 AM|LINK
Nov 07, 2012 04:53 AM|LINK
satbir
don't call it directory use is in a sp
create proc cleanDb
As
DBCC CHECKIDENT(AdminLogIn, RESEED, 0);
create this sp in db
then in code behind
call this as u call other sps
Satbir_4
Member
157 Points
216 Posts
Reset Primary Key to 1
Nov 07, 2012 01:11 AM|LINK
protected void btnRemove_Click(object sender, EventArgs e)
{
DBCC CHECKIDENT(AdminLogIn, RESEED, 0);
}
----------------------------------------------------------- Coding is not working
Expected ; or = (cannot specify constructor arguments in declaration) is there
Dan Bracuk
Contributor
3970 Points
1096 Posts
Re: Reset Primary Key to 1
Nov 07, 2012 02:03 AM|LINK
As long as your primary key does it's job, what difference does it make whether it starts at 1 or 1000000?
subhash.shel...
Contributor
2137 Points
487 Posts
Re: Reset Primary Key to 1
Nov 07, 2012 02:11 AM|LINK
Hi,
First delete the data from table and try.
dbcc checkident('table_name', reseed, 0);
You can ref. below post as well.
http://stackoverflow.com/questions/764004/reset-primary-key
Subhash
Please, Mark as Answer if this reply helped you.
pradeep shar...
Contributor
4004 Points
763 Posts
Re: Reset Primary Key to 1
Nov 07, 2012 03:35 AM|LINK
there r two option
1. delete all records from the table and use dbcc to reset
2. truncate the table it will reset
Satbir_4
Member
157 Points
216 Posts
Re: Reset Primary Key to 1
Nov 07, 2012 04:25 AM|LINK
protected void btnRemove_Click(object sender, EventArgs e)
{
DBCC CHECKIDENT(AdminLogIn, RESEED, 0);
}
----------------------------------------------------------- Coding is not working
Expected ; or = (cannot specify constructor arguments in declaration) is there
pradeep shar...
Contributor
4004 Points
763 Posts
Re: Reset Primary Key to 1
Nov 07, 2012 04:53 AM|LINK
satbir
don't call it directory use is in a sp
create proc cleanDb
As
DBCC CHECKIDENT(AdminLogIn, RESEED, 0);
create this sp in db
then in code behind
call this as u call other sps