October 4, 2006 at 9:15 am
Hi,
I've been informed that the truncate table command is no longer supported in SQL 2005.
Could anyone tell me what it's been replaced by?
October 4, 2006 at 9:22 am
Hi Mark,
Who said that it is not supported in SQL 2005??
Check the SQL 2005 help.
Thanks
Lucky
October 5, 2006 at 7:29 am
i'd speculate that someone tried to truncate a table that was referenced by a foreign key, got an error, and assumed that it was not supported;
truncate table deletes all the data in the table, and resets the indentity function, if it existed on one of the columns, back to 1.
like Lucky said, it is most certainly supported, but since you can't truncate a table referenced by a foreign key, you need to reinitialize the identity column instead.
in Win2K and SQL 2005 the command islike this:
DBCC CHECKIDENT( [#sometable],RESEED,newintvalue)
reseed starting at 1 again:
DBCC CHECKIDENT( [#sometable],RESEED,1)
reseed, but starting at 99 instead:
DBCC CHECKIDENT( [#sometable],RESEED,99)
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply