Solved

Microsoft SQL 2005 SQL Statement Error

Posted on 2008-10-24
2
186 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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Another way of doing this SQL 8 40
Compare data between two databases 16 83
SQL help 5 48
How to use TOP 1 in a T-SQL sub-query? 14 33
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now