September 30, 2015 at 7:45 am
Table Name: Denominator
Already has the following constraint:
PK_Denominatorclustered, unique, primary key located on PRIMARY DenominatorID
How can I add a unique key that will cover the 3 fields --> MemberID,MeasureID,TimePeriodID
I also want to know whether we can include the " WITH ( IGNORE_DUP_KEY=ON ) "
September 30, 2015 at 7:52 am
mw112009 (9/30/2015)
Table Name: Denominator
Already has the following constraint:
PK_Denominatorclustered, unique, primary key located on PRIMARY DenominatorID
How can I add a unique key that will cover the 3 fields --> MemberID,MeasureID,TimePeriodID
I also want to know whether we can include the " WITH ( IGNORE_DUP_KEY=ON ) "
In SSMS, open Object Explorer. Locate your table, expand the node and right-click on the Index node. It's intuitive from there. Once you are done, script the index out so you can see the syntax.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 30, 2015 at 7:53 am
CREATE UNIQUE NONCLUSTERED INDEX [IX_Denominator] ON [dbo].[Denominator]
(
MemberID ASC,
MeasureID ASC,
TimePeriodID ASC
)WITH (IGNORE_DUP_KEY = ON) ON [PRIMARY]
September 30, 2015 at 10:43 am
Carefully review what the best clustered index for this table would be. It's extremely like that all, or some, of the keys in your planned new index should actually be the clustering key set instead. Ignore the myth that an identity should "always" be the clustering key, it can be terrible for overall performance.
Edit: You can keep the identity as the PK if you need to, just make it nonclustered.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply