PdfPrep.com

How should you complete the Transact-SQL code statement?

HOTSPOT

You manage a Microsoft SQL Server environment. You have a database named salesOrders that includes a table named Table1. Table1 becomes corrupt. You repair the table.

You need to verify that all the data in Table1 complies with the schema.

How should you complete the Transact-SQL code statement? To answer, select the appropriate Transact-SQL code segments in the dialog box in the answer area.

Answer:

Explanation:

Box 1: CHECKCONSTRAINTS

DBCC CHECKCONSTRAINTS checks the integrity of a specified constraint or all constraints on a specified table in the current database.

Box 2: ALL_CONSTRAINTS

ALL_CONSTRAINTS checks all enabled and disabled constraints on the table if the table name is specified or if all tables are checked;otherwise, checks only the enabled constraint.

Note: Syntax: DBCC CHECKCONSTRAINTS

[

(

table_name | table_id | constraint_name | constraint_id

)

]

[ WITH

[ { ALL_CONSTRAINTS | ALL_ERRORMSGS } ]

[ , ] [NO_INFOMSGS ]

]

References: https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkconstraints-transact-sql

Exit mobile version