Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Issue after copying data
Message
De
30/11/2010 14:57:32
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
 
 
À
30/11/2010 14:01:50
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01491153
Message ID:
01491171
Vues:
38
You need to truncate tables in the correct order. How log would it take to create a sp that would truncate all your tables?

>Yeah, but that complains when I have FK constraints set.
>
>>TRUNCATE TABLE will reset identity.
>>
>>>I use Red Gate SQL Data Compare to duplicate my production data to a testing database. Basically it's a DELETE followed by a bunch of INSERTs. However, it seems to not reset the identity PK. I keep getting this error:
>>>
>>>{"Violation of PRIMARY KEY constraint 'PK_ApplicationNote'. Cannot insert duplicate key in object 'PreApplication.ApplicationNote'.\r\nThe statement has been terminated."}
>>>
>>>I know I can go in and run a script to reset the identity, but I have to do that on every table every time I do this. Does anybody know of a way to avoid this? Or a global way to reset all identity columns?
>>>
>>>Thanks!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform