Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dbcc
Message
From
29/11/2002 10:11:38
 
 
To
28/11/2002 11:14:18
General information
Forum:
Microsoft SQL Server
Category:
Database management
Title:
Re: Dbcc
Miscellaneous
Thread ID:
00727974
Message ID:
00728166
Views:
11
DBCC will not verify that all detail rows have a corresponding master record. It's up to your application to maintain that relationship. DBCC is used to verify the internal integrity of the database. (It is also the dumping ground for a variety of functionality).

You can create Foreign Key constraints and have the database engine do the checking for you.

CREATE TABLE master (pk int IDENTITY(1,1) ... )
CREATE TABLE detail (pk int IDENTITY(1,1), fk int REFERENCES master(pk) ...)

Here the FK constraint will verify that each row in detail has a corresponding parent in master. If not, an exception will be thrown. The constraint will also verify that no row in child exist before allowing the parent row in master to be deleted. If child rows do exist, an exception will be thrown.

-Mike


>The DBCC is use to check the consistency and integrity of database. It checks physical and logican consistency.
>
>We are using SQL6.5. We used DBCC CHECKDB for checking database and didn't get any errors. But some users found some orphan record (no parent) in some tables.
>Does DBCC check this?
>How can we check this?
>
>What does DBCC check or not check?
>
>
>
>Thanks
>
>
>Jim
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform