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 |
|
xiii29
Starting Member
13 Posts |
Posted - 2005-01-06 : 11:03:19
|
| Hi !I've have an application which update a database with lots of Insert, Update and Delete ... In order to protect data, I'm using a serializable transaction. At the beginning of the update, I remove all foreign keys constraints in order to not to manage order in my querys ... But it seems that some Sch-m locks are set when the application remove constraints ... And thoses locks block all other applications that would also query the database ...As I'm in a serializable transaction, I'm wondering if there is a way to avoid Sch-M locks and remove chekck constraints just for the transaction ...Thanks for any help ! |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2005-01-06 : 12:03:30
|
| Let's get to the real question. Why are you "At the beginning of the update, I remove all foreign keys constraints in order to not to manage order in my querys"?This smells like the real concern you should be having. Foreign keys are there for a reason. Removing them before manipulating the data renders them useless.HTH=================================================================A faith that cannot survive collision with the truth is not worth many regrets. -Arthur C Clarke, science fiction writer (1917- ) |
 |
|
|
xiii29
Starting Member
13 Posts |
Posted - 2005-01-07 : 03:23:36
|
| In fact, the data come from database which respect the same foreign keys constraint, so I'm sure that the data are correct.The fact of removing constrant is to avoid manage reflexive foreign keys or cycle ... |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-01-07 : 08:45:21
|
| The fact is, removing the constraints is a bad idea, even if it were not causing the problems you're having. |
 |
|
|
xiii29
Starting Member
13 Posts |
Posted - 2005-01-07 : 09:14:47
|
| I know this is bad idea ... That's why I do not want them to be remove but to be disable just during the transaction !My favorite solution would be that the system check the constraint during the commit !This will be perfect ! |
 |
|
|
|
|
|