[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2884
  • Last Modified:

CONSTRAINT (IGNORE_DUP_KEY = OFF)

Hi,

I have a script to create a table in which there is a CONSTRAINT, can somebody explain what this CONSTRAINT would achive.

CONSTRAINT [PK_CategoryCategoryHistory] PRIMARY KEY CLUSTERED
(
      [ParentCategoryID] ASC,
      [ChildCategoryID] ASC,
      [SiteLangID] ASC,
      [ParentVersion] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

And also is there a site that would list all the key words used in sql server and explain the usage?
Thanks

0
SA4
Asked:
SA4
1 Solution
 
lahousdenCommented:
As for the site: www.microsoft.com (look for SQL Server).  But, to be brutally frank,  if you want the experts on this site to do all your work for you you will need to part with more than 50 points a pop...
0
 
appariCommented:
from BOL

IGNORE_DUP_KEY = { ON | OFF }
Specifies the error response to duplicate key values in a multiple-row insert operation on a unique clustered or unique nonclustered index. The default is OFF.

ON
A warning message is issued and only the rows violating the unique index fail.

OFF
An error message is issued and the entire INSERT transaction is rolled back.

The IGNORE_DUP_KEY setting applies only to insert operations that occur after the index is created or rebuilt. The setting has no affect during the index operation.

IGNORE_DUP_KEY cannot be set to ON for XML indexes and indexes created on a view.

In backward compatible syntax, WITH IGNORE_DUP_KEY is equivalent to WITH IGNORE_DUP_KEY = ON.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now