Reputation: 1363
created Index
CREATE INDEX MasterIndex
ON [Attendance].[dbo].[Attendence] (location,createdby,program,batch,term)
tried query
SELECT *
FROM [Attendance].[dbo].[Attendence] USE INDEX (MasterIndex) WHERE createdby='pravin' and term='Term III' and batch='80' and program='computer' and location='AMD'
error
Incorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required.
Upvotes: 0
Views: 3161
Reputation: 81950
Use the WITH Clause
SELECT *
FROM [Attendance].[dbo].[Attendence] WITH (INDEX (MasterIndex)) WHERE ...
Upvotes: 4