Contents 

AdeptSQL Diff Reference
AdeptSQl Diff versions, history and milestones
Supported versions of MS SQL Server
Getting started
Connecting to databases
Scanning available servers
Saving and opening comparisons
Running from command line
Diff in portable mode
Working with the schema
Viewing schema differences
Ignored Differences
Comparing objects side-by-side
Dragging and dropping schema items
Using schema filters
Generating comparison reports
Customizing the reports
Executing the SQL
SQL errors and warnings
Transaction support
Keyboard shortcuts
Editing commands and keyboard shortcuts
Using keyboard templates
Choosing debugger's key mapping
Comparing table data
DataDiff overview
DataDiff configuration dialog - table-level
DataDiff configuration dialog - columns
Special situations comparing data
Exporting data to Excel
DataDiff Reports
Column configuration file
Configuring AdeptSQL Diff
Options dialog
Schema Scan
Selective Loading
Comparison
Name Comparison
Code Comparison
User-defined types
Indexes and Statistics
Permissions and XProps
Synonyms
Other details to ignore
Scripting
General logic
Side-by-side scripting
Formatting
Identifiers
Schema Level
Tables
Constraints
Default Values
Procedures, Views, etc
Visuals
Text Fonts
Schema Tree
Summary collections
Side-by-Side View
Suppressed dialogs
Data comparison options
General
Scripting
Column Config File
Using COM Automation interface
Automating schema comparison
Automating data comparison
Licensing and contact info
Registration of AdeptSQL Diff
License conditions
Contact information

AdeptSQL Diff Online Help

Prev Page Next Page

Options / Scripting / Tables / Constraints

Top  Previous  Next

opt_constraintsThe Constraint placement comboboxes allow to choose where in the table definition various types of constraints will be scripted. This setting primarily applies when scripting a CREATE TABLE statement (when two tables are being synchronized, it is:

· Don't generate - these constraints are not included into the "create table" statement. You can generate them later from the "Summary Collections" node of the schema tree, or may be you just want to get rid of some of the constraints. For FOREIGN KEYs this can help to avoid forward references to the tables which aren't defined yet.
· With column means that whenever a constraint depends on a single column only, it will be scripted with this column (e.g. "UserID int references Users(UserID)"). Constraints depending on several columns will be scripted on the table level.
· At table level - the constraint will be scripted inside the CREATE TABLE statement, after all columns. This is not a valid setting for DEFAULT constraints, so the combo box for them does not contain this option.
· Separate - the constraint will be scripted in a separate ALTER TABLE ... ADD statement after the table definition. This setting can be specified for any kind of constraint, although it usually only makes sense to do so for the FOREIGN KEYs.

Comparing and scripting constraint names. On the server, all constraints in a database have unique names. However, in many cases the names are generated by the server itself and need not be known in the SQL scripts (except when deleting the constraints). You can choose whether such "automatic" constraint names should be taken into accoutn when comparing and scripting the constraints. Checking this option causes such constraints to be treated as unnamed:

"Only named", "Ignore names"

"Always"

create table T2 (

   ID Integer Not Null,

   Name VarChar(30) Not Null,

 

   Primary Key(ID,NAME)

);

create table T2 (

   ID Integer Not Null,

   Name VarChar(30) Not Null,

 

   Constraint PK_T2_014935CB

       Primary Key (ID,NAME)

);

Ignore names tells the Diff to consider two constraints identical if they have the same meaning (e.g. the same value for a DEFAULT), even if the names are explicitly specified and different.

Scripting CLUSTERED/NONCLUSTERED - both PRIMARY KEYs and UNIQUE constraints are based on indexes, which can be either clustered or not. For the PK, the index is by default CLUSTERED, whereas a UNIQUE constraint is by default based on a NONCLUSTERED index.  Normally, the Diff would only script the CLUSTERED/NONCLUSTERED keywords where they are really needed, but with this setting you can force them scripted for each PK/UQ constraint. 

Scripting WITH NOCHECK - often there is no need for the server to re-check the entire table when a constraint is added (and especially when it is dropped and then re-created). Adding constraints with NOCHECK option can make the scripts run much faster on large databases. This option can be configured separately for FOREIGN KEYs and for CHECK constraints. Three scripting modes are supported for the WITH NOCHECK clause: (a) it is not used (it's the default, as in previous versions); (b) only script it when re-creating a temporarily dropped constraint; (c) always script WITH NOCHECK. The "NOCHECK re-created constraints" mode is supposed to be safer than scripting all constraints with NOCHECK.  However, both NOCHECK modes should be used only when necessary and reverted back to the "checked" scripting afterwards.

 

   
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)