Solved

create non clustered non unique index sql server 2005

Posted on 2011-02-24
7
810 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

776 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