I disagree with the idea of giving away with constraints at the cost of performance, there are reason to support this
System design does not remain constant so the performance of the system has to be valued with every change.
Changes in design are more fault tolerant when constraints are used
Constraints safegaurd can prevent accidental loss of data or updations, specially when new team of programmers are maintaining the system or people writing reports.
Constaints also provide a guide way for forming proper queries, it assists the writer to write queires which are more efficent and produce less redundant results
Most importantly when you share the same data with other application, accidental addition or deletion of data may cause havok
You can neglect contrainst on tables which can be re-created or information loss can be subsituted in some other way, but for primary tables / masters i do not recommend this.
Main Topics
Browse All Topics





by: imran_fastPosted on 2006-08-22 at 05:35:16ID: 17363098
>> The system will handle financial transactions, and I don't share his 100% confidence in the code or methodology.
Most of the software like one for microsoft (sharepoint) and (gp) they dosen't have foreign keys defined in it the reason is simple. these foreign keys are defined at the time of development to make sure that the code is supporting all the constraints and when it is tested throughly it is deleted for performance reason.
The other reson beside performance is: It is eaisier to know the design of a database which have relation ship (foreign keys) defined on it that the one with no relationships
but in your case you don't trust the code or mehodology in that case you should ask the developer to provide the constraint and you can implement them.
Professional developer keep the copy of the foreign keys and in your case with no check you can alter your database using below code to change all no check constraint to check constraint.
declare @TableName varchar(100)
declare TablesList cursor for select name from sysobjects where xtype = 'U'
open TablesList
fetch next from TablesList into @TableName
while @@fetch_status = 0
begin
exec ('alter table [' + @TableName + '] check constraint all')
fetch next from TablesList into @TableName
end
close TablesList
deallocate TablesList
go