[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Help with SQL Server query syntax

Posted on 2012-09-13
2
Medium Priority
?
554 Views
Last Modified: 2012-09-13
We are (finally) upgrading from MSAccess to SQL Server 2008 R2.  I am new to SQL Server.  I have the following query

<CFSET WeekDate=MakeODBCDate("12/08/2012")>

<CFQUERY NAME="MyQuery" DATASOURCE="JobOrder#Sfx#">
  UPDATE Applic_Temp_Group.dbo.TempEmployeesFile
  INNER JOIN TsheetsThisWeek ON TempEmployeesFile.UniqueVal =TsheetsThisWeek.UniqueVal
  SET TempEmployeesFile.Wkg ='Yes'
  WHERE TsheetsThisWeek.WEnded=<CFQUERYPARAM Value="#WeekDate#" CFSQLTYPE="CF_SQL_DATE">
</CFQUERY>

It crashes and says "Incorrect syntax near the keyword INNER".  What is the correct syntax I need?
0
Comment
Question by:jdthedj
2 Comments
 
LVL 25

Accepted Solution

by:
lwadwell earned 2000 total points
ID: 38397320
try
UPDATE tef
  SET TempEmployeesFile.Wkg ='Yes'
  FROM Applic_Temp_Group.dbo.TempEmployeesFile tef
  INNER JOIN TsheetsThisWeek ON tef.UniqueVal =TsheetsThisWeek.UniqueVal
  WHERE TsheetsThisWeek.WEnded=<CFQUERYPARAM Value="#WeekDate#"
0
 
LVL 3

Author Closing Comment

by:jdthedj
ID: 38397377
Thanks lwadwell - it works fine.  I can see I'm going to have lots of queries to recode!
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

834 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