Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Insert to table alows duplicate primary key entries

$
0
0

I have a small table, Widgets, that has 3 fields: ManufID nvarchar(50), OnHand int, Handle nvarchar(50). ManufId is the primary key, IsUnique true, Ignore Duplicates No

I am running SQLExpress 2014.

I create an INSERT query and I am able to execute the same query multiple times, creating duplicate values in the primary key.

INSERT INTO Widgets
                         (OnHand, ManufID, Handle)
VALUES        (5, N'Widget2', N'Yes')

Also I entered "Widget1", 5, "Yes" and I have some extra brackets in the early entries.

[Widget1], 5, [Yes]

[Widget1], 5, [Yes]

Widget1, 5, Yes

Widget1, 5, Yes

Widget2, 5, No

Widget2, 5, No

Widget2, 5, No

Can you help?





Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>