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! - update loctable
-
set loctable.wscombinedded = ([HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA]/100)
-
(select (([HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA])/100)
-
from hra_data
-
where (hra_data.policy=loctable.accntnum and hra_data.location=loctable.locnum
-
and (HRA_DATA.DPHURRICANEPCT<500 and HRA_DATA.ratcls='cr')
-
OR (HRA_DATA.DPHURRICANEPCT<500 AND HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL='1')
-
OR (HRA_DATA.DPHURRICANEPCT<500 AND HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL='3')
-
OR (HRA_DATA.DPHURRICANEPCT<500 AND HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL='4') )
-
)
-
FROM LOCTABLE, HRA_DATA
-
-
Server: Msg 156, Level 15, State 1, Line 11
-
Incorrect syntax near the keyword 'FROM'.
-
3 28785 - update loctable
-
set loctable.wscombinedded = (
-
select [HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA]/100
-
from hra_data
-
where hra_data.policy=loctable.accntnum and hra_data.location=loctable.locnum
-
and HRA_DATA.DPHURRICANEPCT<500 and
-
(HRA_DATA.ratcls='cr' OR ( HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL in ('1', '3', '4')))
-
)
Thank you.. but when I try this I get an error: - Server: Msg 207, Level 16, State 3, Line 1
-
Invalid column name 'HRA_DATA.DPHURRICANEPCT'.
-
Server: Msg 207, Level 16, State 1, Line 1
-
Invalid column name 'HRA_DATA.COVERAGEA'.
-
Server: Msg 207, Level 16, State 1, Line 1
-
Invalid column name 'DPHURRICANEPCT'.
- update loctable
-
set loctable.wscombinedded = (
-
select [HRA_DATA.DPHURRICANEPCT]*[HRA_DATA.COVERAGEA]/100
-
from hra_data
-
where hra_data.policy=loctable.accntnum and hra_data.location=loctable.locnum
-
and HRA_DATA.DPHURRICANEPCT<500 and
-
(HRA_DATA.ratcls='cr' OR ( HRA_DATA.RATCLS='dp' AND HRA_DATA.RATCOL in ('1', '3', '4')))
-
)
Thanks! It does work... I had a column name entered wrong the 2nd time.
Sign in to post your reply or Sign up for a free account.
Similar topics
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)...
|
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...
|
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...
|
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;" &...
|
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'. ...
|
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,...
|
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...
|
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...
|
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. ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
| |