Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Microsoft SQL 2005 SQL Statement Error

I have this code, which is showing error
SELECT DISTINCT JobNo FROM #UpdateReceiving (INDEX(XI_UpdateReceiving), NOLOCK)
Error:
Msg 1018, Level 15, State 1, Line 1
Incorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax.
0
Mehram
Asked:
Mehram
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
SELECT DISTINCT JobNo FROM #UpdateReceiving (WITH INDEX(XI_UpdateReceiving), NOLOCK)
0
 
adatheladCommented:
The WITH needs to go outside the brackets:

SELECT DISTINCT JobNo FROM #UpdateReceiving WITH (INDEX(XI_UpdateReceiving), NOLOCK)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now