Solved

Microsoft SQL 2005 SQL Statement Error

Posted on 2008-10-24
2
189 Views
Last Modified: 2010-03-19
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
Comment
Question by:Mehram
2 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22794138
SELECT DISTINCT JobNo FROM #UpdateReceiving (WITH INDEX(XI_UpdateReceiving), NOLOCK)
0
 
LVL 23

Accepted Solution

by:
adathelad earned 500 total points
ID: 22794293
The WITH needs to go outside the brackets:

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

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Query 2 61
Passing value to a stored procedure 8 99
SQL query to summarize items per month 5 59
Anyway to make these 2 SQL statements into one? 13 39
This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question