Solved

create non clustered non unique index sql server 2005

Posted on 2011-02-24
7
783 Views
Last Modified: 2012-05-11
Expert,

how to create non unique non clustered index? Is this correct?

CREATE NONCLUSTERED INDEX IX_SalesPerson_SalesQuota_SalesYTD
    ON Sales.SalesPerson (SalesQuota);
GO
Thanks,

Lynn
0
Comment
Question by:yrcdba7
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 18

Expert Comment

by:sventhan
ID: 34971982
CREATE NONCLUSTERED INDEX IX_SalesPerson_SalesQuota_SalesYTD
    ON Sales.SalesPerson (SalesQuota);
GO

or

CREATE INDEX IX_SalesPerson_SalesQuota_SalesYTD
    ON Sales.SalesPerson (SalesQuota);
GO
0
 
LVL 18

Expert Comment

by:sventhan
ID: 34971991
Syntax:

create index index_name on table(columnname)
0
 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 34972098
yes your syntax is currect
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:yrcdba7
ID: 34972101
Thank you,

how about clustered non-unique index?
0
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
ID: 34972136
Did you check the msdn? http://msdn.microsoft.com/en-us/library/ms188783.aspx
C. Creating a unique nonclustered index

The following example creates a unique nonclustered index on the Name column of the Production.UnitMeasure table. The index will enforce uniqueness on the data inserted into the Name column.

Copy
USE AdventureWorks2008R2;
GO
IF EXISTS (SELECT name from sys.indexes
             WHERE name = N'AK_UnitMeasure_Name')
    DROP INDEX AK_UnitMeasure_Name ON Production.UnitMeasure;
GO
CREATE UNIQUE INDEX AK_UnitMeasure_Name 
    ON Production.UnitMeasure(Name);
GO

Open in new window

If you don't mention UNIQUE, it won't create UNIQUE index.
0
 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 34972266
you syntax will create a nonclustered nonunique index

create NONCLUSTERED index ABC_IDX on mytable(mycolumn)  = nonclustered nonunique

create UNIQUE  NONCLUSTERED index ABC_IDX on mytable(mycolumn)  = nonclustered unique

create CLUSTERED index ABC_IDX on mytable(mycolumn)  = clustered nonunique

create unique  CLUSTERED index ABC_IDX on mytable(mycolumn)  = clustered unique
0
 

Author Comment

by:yrcdba7
ID: 34973918
Thankyou, Lynn
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now