473,385 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Incorrect syntax near the keyword 'FROM'

5
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 28785
almaz
168 Expert 100+
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
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
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
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)...
11
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...
2
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...
2
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;" &...
2
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'. ...
0
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,...
3
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...
10
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...
1
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. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.