Truncating a table referenced by a foreign key

Posted by born to hula on Stack Overflow See other posts from Stack Overflow or by born to hula
Published on 2010-03-08T19:12:57Z Indexed on 2010/03/08 19:21 UTC
Read the original article Hit count: 190

Filed under:
|
|

Hey,

We have two tables in a SQL Server 2005 database, A and B.There is a service which truncates table A every day.

Recently, a foreign key constraint was added to table B, referencing table A. As a result, it isn't possible truncating table A anymore, even if table B is empty. Is there any workaround to get the same result as truncating table A?

I've already tried the approach below but the identity wasn't reset.

DBCC CHECKIDENT (TABLENAME, RESEED, 0)

PS. before anyone points this as a duplicate, the different thing here is that I'm not allowed to drop constraints, nor creating any.

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about truncate