473,765 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Incorrect syntax near the keyword 'FROM'

5 New Member
Hello,

This is my first post and I am a beginner with SQL code. The code below is supposed to update a new table (loctable) with a calculated value based on the original table (hra_data). There are 3 possibilities in the hra_data table that will cause the loctable to be updated with the calculated value. After playing with it, I thought it was in the correct format but I keep getting an "Incorrect syntax..." error. Any guidence would be greatly appreciated! Since I'm a beginner, I assume its a simple issue. :)

Thanks!

Expand|Select|Wrap|Line Numbers
  1. update loctable 
  2.     set loctable.wscombinedded = ([HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA]/100)
  3.         (select (([HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA])/100)
  4.             from hra_data
  5.             where (hra_data.policy=loctable.accntnum and hra_data.location=loctable.locnum
  6.                 and        (HRA_DATA.DPHURRICANEPCT<500 and HRA_DATA.ratcls='cr') 
  7.                     OR (HRA_DATA.DPHURRICANEPCT<500 AND HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL='1')
  8.                     OR (HRA_DATA.DPHURRICANEPCT<500 AND HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL='3')
  9.                     OR (HRA_DATA.DPHURRICANEPCT<500 AND HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL='4')    )
  10.                 )
  11.         FROM LOCTABLE, HRA_DATA    
  12.  
  13. Server: Msg 156, Level 15, State 1, Line 11
  14. Incorrect syntax near the keyword 'FROM'.
  15.  
Mar 1 '07 #1
3 28921
almaz
168 Recognized Expert New Member
Expand|Select|Wrap|Line Numbers
  1. update loctable 
  2. set loctable.wscombinedded = (
  3.     select [HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA]/100
  4.     from hra_data
  5.     where hra_data.policy=loctable.accntnum and hra_data.location=loctable.locnum
  6.     and HRA_DATA.DPHURRICANEPCT<500 and 
  7.         (HRA_DATA.ratcls='cr' OR ( HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL in ('1', '3', '4')))
  8. )
Mar 1 '07 #2
wallic
5 New Member
Thank you.. but when I try this I get an error:
Expand|Select|Wrap|Line Numbers
  1. Server: Msg 207, Level 16, State 3, Line 1
  2. Invalid column name 'HRA_DATA.DPHURRICANEPCT'.
  3. Server: Msg 207, Level 16, State 1, Line 1
  4. Invalid column name 'HRA_DATA.COVERAGEA'.
  5. Server: Msg 207, Level 16, State 1, Line 1
  6. Invalid column name 'DPHURRICANEPCT'.
Expand|Select|Wrap|Line Numbers
  1. update loctable 
  2. set loctable.wscombinedded = (
  3.     select [HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA]/100
  4.     from hra_data
  5.     where hra_data.policy=loctable.accntnum and hra_data.location=loctable.locnum
  6.     and HRA_DATA.DPHURRICANEPCT<500 and 
  7.         (HRA_DATA.ratcls='cr' OR ( HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL in ('1', '3', '4')))
  8. )
Mar 2 '07 #3
wallic
5 New Member
Thanks! It does work... I had a column name entered wrong the 2nd time.
Mar 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
14194
by: Jeff Magouirk | last post by:
Dear Group, I am trying to create a view and keep getting the Incorrect syntax near the keyword 'Declare'" error. Here is the code I am writing. Create view fixed_airs (sid, fad_a2, fad_a3) as Declare @sid int, @fad_a2 int,
11
7109
by: Mark Findlay | last post by:
Hello Experts! I am attempting to use the OleDbCommand.ExecuteScaler() function within my ASP.NET C# web page to perform a simple validation, but receive the following error: "Incorrect syntax near the keyword 'DEFAULT'" The form has 2 fields on it, called tb_username and tb_password. (see code snippet below).
2
4540
by: JMUApache | last post by:
Hi, I have got a error message while I run a sample OLEDB program. It says "Incorrect Syntax Near The Keyword Default Information". platform: Windows XP + Visual Studio 2005 Beta 2 + SQL Server 2000 I goole it, somebody says the reason is the database file size up to its limit, and set the Maximum File Size to Unrestricted File Growth. But it's not suite my case.
2
2018
by: Jon | last post by:
hi, i was trying to create a DB in a SQL Server. but when i try to connect it with : Dim conn As SqlConnection = New SqlConnection("Initial Catalog=master; " & _ "Data Source=SERVER-MACHINE;" & _ "UID=sa; PWD=;") It gave me this SQLexception "Incorrect syntax near keyword 'ON" which i have no idea what it means............
2
10845
by: ielmrani via SQLMonster.com | last post by:
Hi Everyone, I really tried to not post this question but I gave up. I tried brackets, parenth...etc but nothing worked. I get this error message: Incorrect syntax near the keyword 'THEN'. Please help, I am learning SQL Server. thanks in advance. Ismail use mis select CLAIM_DETAILS_HCVW.INTEREST, CLAIM_DETAILS_HCVW.NET, CLAIM_HMASTERS_VS.
0
1893
by: netone | last post by:
I am developing site using dot NET.... when I use this sql query Dim mydata As String = "SELECT director.applno, district.distName, disabappl.recvddate_sdo, disabappissue.IDCardNo, director.dreceived_director" _ & " FROM director INNER JOIN disabappl ON director.applno = disabappl.applno INNER JOIN " _ & " district ON disabappl.submitted_dist = district.dist_cd INNER JOIN" _ &...
3
15848
by: Skillman | last post by:
Hi Everybody, I'm beginer in SQL and was wonder if anybody could take a look at this and help me. I got this error, and not sure how to fix it. This is the error: Msg 156, Level 15, State 1, Line 6 Incorrect syntax near the keyword 'AS'. Any help so much appreciated with as(
10
3424
by: arial | last post by:
Hi, I am getting this error message: Incorrect syntax near the keyword 'where'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'where'. Source Error:
1
6264
by: karenkksh | last post by:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'user'. Source Error: Line 35: MyAdapter1 = new SqlDataAdapter(MyCommand1); Line 36: MyDataSet1 = new DataSet(); Line 37: ...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.