[Company Logo Image] 

Home Up Contents Coffee Break Credits Glossary Links Search

 
Creating Indexes on a Create Table Statement

 

 

Home
Analysis Services
Azure
CLR Integration
High Availability
Open Source
Security
SQL Server 2008
SQL Server 2012
SQL Server 2014
SQL Server 2016
SQL Server 2017
SQL Server 2019
Tips
Troubleshooting
Tuning

Creating Indexes on a Create Table Statement.


Applies to: Microsoft SQL Server 2014.


SQL Server 2014 allows to create a table and its indexes on one CREATE TABLE statement as shown below:


CREATE TABLE [dbo].[Employees](
[EmployeeId] [int] IDENTITY(1,1) PRIMARY KEY CLUSTERED,
[LastName] [varchar](50) NULL,
[FirstName] [varchar](50) NULL,
[SSN] [varchar](50) NULL,
INDEX DBA_IX_Employees_SSN NONCLUSTERED (SSN)
) ON [PRIMARY]

GO






Reference.


CREATE TABLE (SQL Server).


 

 

 

.Send mail to webmaster@sqlcoffee.com with questions or comments about this web site.