Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2004, 02:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default UPDATE syntax

I have this Access update query

UPDATE [T_Parameter]
INNER JOIN [T_SetupSheetParametersDetail]
     ON [T_Parameter].ParameterID = [T_SetupSheetParametersDetail].ParameterID SET [T_SetupSheetParametersDetail].ListOrder = [T_Parameter].[ListORder]

That I am trying to make work on MS SQL 2000, but I get an error: Incorrect syntax near the keyword 'INNER'.

I have tried to re-write it several different ways, and still can't get it to work.
__________________
Mitch
 
Old February 6th, 2004, 04:21 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Move your 'SET' statement just above your 'inner join'.
You also need a 'FROM' for inner join to work.

So, it should look like this:

UPDATE [T_Parameter]
SET [T_SetupSheetParametersDetail].ListOrder = [T_Parameter].[ListORder]

FROM [T_Parameter]
INNER JOIN [T_SetupSheetParametersDetail]
     ON [T_Parameter].ParameterID = [T_SetupSheetParametersDetail].ParameterID
 
Old February 6th, 2004, 05:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I actually needed to modify what you suggested becasue I failed to indicate which table I was updating, so it was switched in your example. The following worked:

UPDATE [T_SetupSheetParametersDetail]
SET [T_SetupSheetParametersDetail].ListOrder = [T_Parameter].[ListORder]

FROM [T_Parameter]
INNER JOIN [T_SetupSheetParametersDetail]
     ON [T_Parameter].ParameterID = [T_SetupSheetParametersDetail].ParameterID

Thanks a lot, I kept hitting my head trying to figure why the syntax was wrong.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error on UPDATE ktmai2001 Access 6 November 24th, 2008 12:45 PM
Syntax Error in the update statement annie_t Access ASP 1 February 1st, 2005 12:48 PM
Syntax Error in Update Louisa VB.NET 2002/2003 Basics 2 March 23rd, 2004 05:27 AM
UPDATE statement returns syntax error AviatorTim Classic ASP Databases 2 January 8th, 2004 05:22 PM
update syntax error Adam H-W Classic ASP Databases 2 July 24th, 2003 07:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.