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.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Data Integrity Management..

Author  Topic 

blocker
Yak Posting Veteran

89 Posts

Posted - 2010-03-22 : 21:04:28
Good day.

I just want to ask on how to achieve a full boost data integrity structure in sql server.

Thank you for your ideas. God bless.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-22 : 21:15:47
I don't understand what you want. What is a "full boost data integrity structure"?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

blocker
Yak Posting Veteran

89 Posts

Posted - 2010-03-23 : 00:43:16
An intity/table design that will update all related data when it is changed/modified. Ex. if the product name was changed in table_1 all product names in table_2 and so on with the same productid will automaticaly updated. Another example is, when the product has other invoices pending, sql server will prevent it from being deleted.. This is called data integrity. My question is how to achieve this structure/flow?

Thank you for the idea. God bless.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-23 : 12:27:53
It's through foreign keys. For the automatic update part, you have to add the cascade option.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

blocker
Yak Posting Veteran

89 Posts

Posted - 2010-03-23 : 21:05:33
i have succesfully set-up the primary key in the main table and foreign keys on the child table. but i do not know what do you mean about cascade option.? Is there anything i need to set-up on my main table and child tables aside from primary keys & foreign keys.?

Thank you for the ideas. God bless.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-23 : 21:09:55
The foreign keys must be setup with the cascade option in order to automatically delete or update data. See Books Online for more information.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-03-24 : 04:26:37
" what do you mean about cascade option. "

FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson(SalesPersonID)
ON UPDATE CASCADE
Go to Top of Page

blocker
Yak Posting Veteran

89 Posts

Posted - 2010-03-24 : 04:40:49
thank you.. this helps m a lot..God bless us all.
Go to Top of Page
   

- Advertisement -