Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
bpgupta
Yak Posting Veteran
75 Posts |
Posted - 2008-05-15 : 03:36:41
|
| Hi,I am facing some issue in SQL 2005. There are five tables and tables having foreign check constrainst to child and parent relationship.Now the issues is that i am able to delete the table in order wise and i am not able to truncate the all the tables in the same order.Msg 4712, Level 16, State 1, Line 1Cannot truncate table 'dbo.Tb_to_Markets' because it is being referenced by a FOREIGN KEY constraint.But the same table i am delete it.what can be cause for this error.Thanks, |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-15 : 04:11:58
|
| As error suggests you have some data in 'dbo.Tb_to_Markets' table thats being referenced by column in another table. so either you have to drop the foreign constraint from other table or make value of that column to NULL before you DELETE from this tableFirst run sp_help 'dbo.Tb_to_Markets' to understand which table is referring this |
 |
|
|
bpgupta
Yak Posting Veteran
75 Posts |
Posted - 2008-05-15 : 04:41:01
|
| Vikash,I have already mentioned that i can delete all the records, but while truncating the table that error is not coming, why not that error is showing when i delete the records from that tables.Hope my question is not clear.I am using sql 2005. |
 |
|
|
|
|
|