Translate

Wednesday, 28 November 2018

SQL : Add non cluster index in SQL table by query

create table tblSample2008
(
id int primary key not null identity(1,1),
name varchar(100),
city varchar(50)
)

CREATE NONCLUSTERED INDEX city_MyCustom_NonclusterIndex
ON tblSample2008 (city asc)



CREATE TABLE [dbo].[tblSample2008](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](100) NULL,
[city] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

No comments:

Post a Comment