Try to use truncate instead of delete to remove records from your table, it will remove records and reset identity fields to starting values.
Thanks
Try to use truncate instead of delete to remove records from your table, it will remove records and reset identity fields to starting values.
Thanks
Reset the Identity Increment
Hello:
I have a table with a bigint type column (field) that has an identity seed
of 1 and an identity increment of 1. The column is the primary key for the
table.
After I backup and clean out the database (delete all of the data in the DB)
I need to have the column with the identiy seed/increment value reset to 1
automatically. (start counting at 1 again). How does one do that, because
as it is now, the DB keeps increasing the value of the column from where it
left off, regardless of the fact that I deleted all of the data in the
table.
The DB is MS SQL Server 2000.
Thanks and appreciate any help.The only way to do that is to use truncate table instead of delete.
You need additional rights to be able to execute truncate table statement.
Good Luck.
Irina.|||Yes, of course you can use truncate. It will delete and reseed the identity columns.
It is also more efficient way to save the resources.
But, if you also want to use delete, you can reset the identity column by running the following command:
DBCC CHECKIDENT('mytable', RESEED, 0) ;
Hope to help.
This is what I've tried so far, but it resets on every page.
So, each page is 1 even if the Unique ID spans 2-3 pages.
I only need it to reset on a new field grouping of the list object.
Here's the VB code for the report:
Shared offset As Integer
Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function
***************************
In the header, I have a textbox named "tag"
In the footer, I've got the following expression:
="Unique ID Page: " & Code.GetPN(Not(ReportItems!tag.Value Is Nothing),Globals!PageNumber)
Blank
|||My fault...I had the textbox "tag" in the page header and not in the list object itself.
It works!
Thanks!