Translate

Wednesday 24 December 2014

How to create nonclustered index in Create Table?

The help in books online does in fact mention the keyword CLUSTERED, but it is only relevant for UNIQUE or PRIMARY KEY constraints. Both these constraints create an index, and you can specify if that index is to be clustered or non-clustered.

You cannot use that syntax to create a standard non clustered index.

Create table FavoriteDish  
(  
FavID int identity (1,1) primary key not null,  
DishID int references Dishes(DishID) not null ,  
CelebrityName nvarchar(100)   constraint ux_CelebrityName unique NONCLUSTERED not null    
)

Database Tips

SOFTWARE TECHNOLOGY TIPS

Getting List Of tables With Number Of Records Of Each In SQL Server
UpsizingWizard to migrate an AccessDB to SQL
Right Join Using Left Join Clause
Automatic Database(MySQL) backup
Using =null instead of isnull
Some Interesting features of ENUM data type in MySQL
Use of SET NOCOUNT in stored procedures
Screen all incoming query-strings to prevent SQL injection
Empty or Shrink the database
Some Useful SQL Queries
Swap table name in MySQL, SQL Server
GO (Transact-SQL)
SQL Query Optimization
Self join and its usage
Reset the identity column  next inserting identity value.
Execute sql stored procedure or sql query from Access.
How To Make A Case Sensitive SQL Query Search
Extended Properties for Documenting the SqlServer Database
Display Dates In A  Range
Secure Way Of Executing The Update Statement In Sql Server
How to take backup of SQL Server database schedule wise
How To Encrypt All Store Procedure In SQL Server Database
Configuring MSSQL Server to talk to PHP in Ubuntu
Dynamic Where Clause
Sending Email in Oracle/plSql
Remove Multiple Spaces from a string using SQL Server
How to preserve SQLite db in AIR application uninstallation/reinstallation
How to drop primary key constraint in SQL Server
How to configure C3P0 connection pooling in Hibernate
How to delete duplicate rows in a table using CTE
Physical Mysql - what are these? (.FRM, .MYI, .MYD). Need this?
How to find those tables which do not have any auto-incremental column in SQL Server
Use Stored Procedure's result set in Inline Query or in another stored procedure
Limiting the retrieval of data in SQL Server 2008
Calculate Geographical Area using SQL Server
Printing the query executed last  by codeigniter framework using active record class
Temporary Tables or Table Variables: Choose One!
Deleting Duplicate Data In MySQL
How to find the engines of MySQL tables
How to add row number in a query result set.
Creating and inserting data to a table using the SELECT statement
Stored Procedure execution using MySQL Extension
Common Table Expression in SQL Server
Fetch Nth Column of a Table
Using FIELD function in ORDER BY clause in MySQL
Table variables in SQL Server
How to use Transaction in Entity FrameWork?
EXPLAIN your query in MySQL
Find Stored Procedure (s)/Function(s) related  to a Table(s) in Database
Difference between utf8_general_ci and utf8_unicode_ci
Access data from remote database server using FEDERATED Storage Engine in MySQL 5.0 and up
Using Pivot Operator in SQL- Server
XML DataType in SQL Server 2005
Count affected rows after SQL Query Statement
Difference between @@IDENTITY, SCOPE_IDENTITY() and IDENT_CURRENT() in SQL SERVER
Search datetime data in SQL Server (using 'where' clause?)
SQL Server Index - V (Index Fragmentation)
How to update field values partially in MySQL UPDATE statement?
SQL Server Index - I (Basics)
SQL Server Index - II (Clustered Index)
SQLServer Index - III (Non-Clustered Index)
SQL Server Index - IV (Composite and Covering Index)
INSERT data from one table into another
INSERT, UPADTE or DELETE a row and return column/columns value with single query
Using BINARY function in MySQL for case sensitive search
MYSQL Binary Logs And Purge
Sort data according to value of two columns
How to find DB size and table info in MYSQL
Think Before Using 'Distinct' Command Arbitarily
How to return Modified data in SQL Server
DateTime Mystery In SQL Server
Fixing Reporting System UI issue in IE8
Make  Your "Order By" Clause  Dynamic
Using CASE expression in SQL queries
How to copy data to an identical table in another database
Using "WITH TIES" SQL Clause
DATALENGTH() AND LEN()
Dealing with NULL values in SQL Server
Executing SSIS package from local machine using C# code
Retrieving List of DB created by user from SQL Express 2005
SET and SELECT in SQL Server
Why not to use TEXT data type in SQL Server 2000
Using SQL JOIN to get data from different tables conditionally
How to swap data between columns in SQL Server
How to Escape Wildcard Characters While Searching in SQL Server 
Renaming Database Objects
Get list of existing TRIGGERs in MYSQL
Replace function in MySQL
Backup SQL Database Through Code In VB.NET
How to get the Deleted Identity Numbers in SQL Server 2005
TRY- CATCH in SQL SERVER 2005/2008
Using Regular Expressions with MySQL queries to Search
MySQL: Using "ON DUPLICATE KEY UPDATE" while inserting record
SQLSERVER Transaction rollback
Display summary report using a simple query in MYSQL
MySQL: Implementing case-sensitive functionality in query
How to use UPDATE with JOIN in SQL queries
Selecting records from more than One Database Using Single Query
Avoid Causing havoc with Live Site/DB
Store data temporarily on your page and finally insert it into database
How to select Random rows in SQL Server using TABLESAMPLE
T-SQL: Finding Top and Bottom records
Top with ties option in SQL Server
How to backup and restore MySQL database.
MSSQL-Insert records for columns where IDENTITY is set
How to create folders in SQLReport server dynamically ?
T- SQL: Query with case-sensitve functionality
Using Having clause with Count function in SQL
Forming Comma Separated String in SQL Server
Deleting Duplicate records in SQL Server
Run the existing SQL Script programmatically with SMO
SQL Server: Restrict the duplicate insertion of records to the database using Store Procedure
MySQL : Exporting The Resultset of a Table into CSV File
MySQL: How to get the Particular Data Range
How To Set Page Break in a report Conditionally
Get database connection string using UDL files
SQL Server : Multiple record insert
Making Inserts into from one table to another table excluding duplicates - without using cursor / temp table/ loop
MySQL: Filter or Search Records Using Regular Expression
How to add dynamic data in to the SQL Report header and footer
MYSQL:Ordering A TextField Numerically
SqlServer Query Optimization Tips
Importance of Max Degree of Parallelism in SQL Server
Use of cross apply to show ',' separated values(SQL Server)
How to create temporary table in MySQL
How to relocate database from C#.NET (SQL Server 2000)
Which one to use in a SQL query:-"Not Exists"/ Left Join / Not In"?
Consuming No space for storing NULL value in table
Set the Recovery model of the database to Simple/Full
How to display tabular data in CLR proc
How to use a comma seperated list as paramater to a stored procedure
MySQL: Ordering values according to a predefined pattern
Bulk Copy with Oracle using Array Binding
Capture identity values while inserting multiple rows in Sql Server 2005
New Line character and Forming a comma Separated String in SQL Server
Transact-SQL :- ROW_NUMBER()
Advantage of  sp_executesql over Exec
How to INSERT, UPDATE or DELETE record in one statement
Some Useful Date Time conversion Tips in SQL
Using Inner Cursor in MySQL
How to insert more than one record using a single insert statement
How to use double quotes in dynamic SQL statements
How to use the Transact-SQL functions CONTAINSTABLE and CONTAINS to do a search on a full-text enabled table
SQL Server Update Statistics
Avoiding the use of Triggers in SQL Server
Get Record Count of a table in SQL Server without doing a Table Scan
User friendly DATETIME Functions in SQL Server 2008
How to reuse query execution plan?