Syntax errors in update query

Below is the query:
UPDATE CFQCC
SET sp_CFQCorr.RecImported = 1, 
CFQCC.RecImported = 1
from [HR_DEV_DM].[CFQ_TEST].CFQ_Coord_Corrections as CFQCC
INNER JOIN [HR_DEV_DM].[CFQ_TEST].sp_CFQ_Coord_Corrections as sp_CFQCorr
ON CFQCC.CorrID = sp_CFQCorr.ID 
WHERE (((sp_CFQCorr.RecImported)=0) 
AND ((CFQCC.RecImported)=0));
When executed, it gives the below error:
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "sp_CFQCorr.RecImported" could not be bound.
Please help....

UPDATE Table1, Table2
SET Table1.Column1 = 'one'
,Table2.Column2 = 'two'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = 'id1'

Similar Messages

  • Syntax error in 'UPDATE' query  ???

    hi..
    i know there is something wrong with this query..but not able to find it out.
    i am using session bean in my project..in one of the method of the bean class, i am updating 'Acc_holder' table.
    below is the code
    public String insDeposit(String vuserid, String vaccountno, int amount, int chqno)
      ...   //connection code
      Statement stmt=null;
      query="UPDATE Acc_holder SET balance=balance" + vamount + "WHERE userid=' "+vuserid+" ' ";
    }In above query, Acc_holder Table has balance(int), vamount(int), userid(varchar) fields.
    when i run, error msg that i get is "java.rmi.RemoteException...java.sql.SQLException:...Incorrect syntax near 'userid'.
    please suggest how this query should be formatted

    Use a prepared statement.
    And after you start doing that then put a space in front of the 'where'

  • Syntax errors in update query with inner joins and sub query.

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....
    sp_CFQ_Coord_Corrections is a table and not a stored procedure.
    are these both tables "sp_CFQ_Coord_Corrections" and "CFQ_Coord_Corrections" different ??

  • JDBC: Syntax error in UPDATE statement???

    Hi,
    I have been trying to solve this seemingly simple problem for the past 4 hours, and I had no success. I am working on a jdbc:odbc connection which utilizes MS Access. I have been constantly getting "Syntax error in UPDATE statement", and this is the statement
    (name of the table is CDs, columns are number, artist, album, label and date - all strings):
    query = "UPDATE CDs SET artist = '" + fields.artist.getText() +"', album = '" +
    fields.album.getText() + "', label = '" +
    fields.label.getText() + "', date = '" +
    fields.date.getText() + "' WHERE number = '" + fields.number.getText() + "'";
    Can anybody recognize an error? Thank you,
    mirkokrug

    A couple of possibilities.
    If the column NUMBER is numeric then it wouldn't need quotes around the data value. Also if the column DATE is a date or date/time type then the format from the textbox may not be correct.
    Col

  • [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

    Hi,
    I am getting following error message ,
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
    When run this code.
    <%@ page import= "java.sql.*"%>
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
    Statement st = con.createStatement();
    st.executeUpdate("update tscipshift set 11-Aug-08='M' where TechN='Elamparuthi'");
    %>
    tscipshift=table ,column=11-Aug-08 are all exist.
    I dont know why I am getting error mesage.
    Any idea why?

    Shahbaz2008 wrote:
    you haven't set your user name and password hereI don't believe that's necessary with Access. Then again, it's not an enterprise database.
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
    change it to this
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","+username+","+password+");
    here pass your username and password...
    In Oracle default user name and password is
    username = scott
    password = tigerSo who uses that? Only an eejit would leave that account open.
    So the statement would be
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","scott","tiger");
    or In Mirosoft Access there is no user name and password so the statement will be Like I said - unnecessary, and not the reason the OP is having problems.
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","","");>
    Besides this change your table name 11-Aug-08 to anything that is not start with number or any special symbols.
    for example aug112008 is good or aug is too good.No, it's still not good if you understand ANYTHING about relational databases and normalization.
    I think it would work.I think you're just as stup!d as the OP.
    %

  • Syntax error in ABAP query after implement patch

    Dear All,
    After implement patch from SAPKA46C39 to SAPKA46C53, we have syntax error in our query.
    our SAP release version is 46C.
    The error in query is -The data object "R01" does not have a component called "046" -
    We don't found any SAP notes that match for our error.
    Anyone ..please help...
    Thanks a lot...
    Budituta

    Hi,
    The query generated is based on the table structures available as they are used, etc.
    So please check if there is any difference in the fields available in the tables used, LDB used if any.
    In addition, may be few of the properties of the SAP query and info set does not get copied properly.
    and after activating the info set only, activate the query, etc...check them once again.
    Regards,
    Santhosh.

  • Syntax error in insert query

    I have a flash form that is used to inserts a record into an
    Access database table. In the for there are 4 datefields, several
    text input fields, and several select fields. When I submit the
    form, I get a syntax error that reads:
    Executing Database Query. [Macromedia][SequeLink JDBC
    Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]
    Syntax error in INSERT INTO statement.
    The error occurred on line 184. Complex object types cannot
    be converted to simple values.
    Line 184 is the last line of the Values in the insert query.
    The query looks like this:
    <CFQUERY DATASOURCE="#REQUEST.DataSource#">
    INSERT INTO EstimateNumber(
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    Updated,
    ReviewDate,
    ReviewedBy,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    #FORM.SafetyChecklistDate#,
    #FORM.QCChecklist#,
    '#FORM.QCChecklistDate#',
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    #FORM.Updated#,
    #FORM.ReviewDate#,
    #FORM.ReviewedBy#,
    #FORM.Discipline#,
    #FORM.BidDate#,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    </CFQUERY>
    Any recomendations?

    Date/Time in Access provide some pretty strage hurdles. In
    many occassions I have simply changed the field to a Text field and
    ran with that and never seemed to have problems with the result. I
    didn't like doing it but I never received errors. I have been
    receiving some parameter errors with <cfqueryparam> like the
    database doesn't recognized the preceding declared field in the
    update or insert query. Here is an example of a wierd error with
    Access. I have 2 tables. One is for estimate numbers and the other
    is for sub estimate numbers that can be assigned to specific
    estimate numbers. If is actually a complicated explanation about
    what is taking place behind the doors on this. The concept is
    simple on the surface. Both tables have the same fields except the
    subestimate table has 1 extra for a user defined subestimate
    number. The only relation between the two will be the estimate
    number. This insert works fine.
    INSERT INTO EstimateNumber(
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    ReviewDate,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    <cfqueryparam
    value="#FORM.SafetyChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.QCChecklist#,
    <cfqueryparam
    value="#FORM.QCChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    <cfqueryparam
    value="#FORM.ReviewDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.Discipline#,
    <cfqueryparam
    value="#FORM.BidDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    This next one is the same exact query with the same table
    setup with one added field but kicks back a parmeter error
    expecting 4. I can't explain it.
    INSERT INTO SubEstimate(SubBidNumber,
    BidNumber,
    Project,
    JobSite,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword,
    ReviewDate,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    VALUES(#FORM.SubBidNumber#,
    #FORM.BidNumber#,
    '#FORM.Project#',
    '#FORM.JobSite#',
    '#FORM.EstimatedBy#',
    #FORM.Region#,
    #FORM.Company#,
    #FORM.Division#,
    '#FORM.InquiryNumber#',
    #FORM.SafetyChecklist#,
    <cfqueryparam
    value="#FORM.SafetyChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.QCChecklist#,
    <cfqueryparam
    value="#FORM.QCChecklistDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.EstimatedValue#,
    '#FORM.UserUsername#',
    '#FORM.UserPassword#',
    <cfqueryparam
    value="#FORM.ReviewDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.Discipline#,
    <cfqueryparam
    value="#FORM.BidDate#"
    cfsqltype="CF_SQL_DATE "
    maxlength="50"
    >,
    #FORM.JobNumber#,
    '#FORM.UpdatedBy#'
    IF I get rid of the cfqueryparam fields it works. If I simply
    remove the param, I get a Syntax error. Needless to say I commented
    this query for the sake of sanity for the time being.

  • Error in update query involving different databases

    Hi everybody,
    I get the error "ORA : 00933 SQL Command not properly ended"
    when I try to execute the following query, in oracle8i. Also the tables it involves are from different db. I tried to put @server_name after the table name but still it didn't work:
    UPDATE ASAP.CAP_NW_CONN_DUMP cncd
         SET MS_INIT = ep1.task_status, HANDSET_DEL = ep3.task_status,
         ACTIVATION = ep.task_status, MS_UPDT = ep2.task_status,
         MS_FNL = ep4.task_status
    ep1.task_status, ep3.task_status, ep.task_status, ep2.task_status, ep4.task_status
    FROM eposmig.t_intf_order_task_dtls@eposload ep, eposmig.t_intf_order_task_dtls ep1, eposmig.t_intf_order_task_dtls ep2,
         eposmig.t_intf_order_task_dtls ep3, eposmig.t_intf_order_task_dtls ep4,
         eposmig.pos_order_lines@eposload pol
    WHERE cncd.ident_text = pol.telephone_no
    AND ep.task_type LIKE 'ACT%'
    AND ep1.task_TYPE = 'MSOLV-INIT'
    AND ep2.task_TYPE = 'MSOLV-UPDATE'
    AND ep3.task_type = 'MSOLV-FINAL'
    AND ep4.task_type = 'HANDSET-DEL'
    AND ep.ORDER_NBR = pol.ORDER_NBR
    AND ep1.ORDER_NBR = pol.ORDER_NBR
    AND ep2.ORDER_NBR = pol.ORDER_NBR
    AND ep3.ORDER_NBR = pol.ORDER_NBR
    AND ep4.ORDER_NBR = pol.ORDER_NBR
    AND pol.order_line_nbr IN (SELECT MAX(order_line_nbr) FROM eposmig.pos_order_lines
                                            WHERE telephone_no IN (SELECT ident_text FROM asap.cap_nw_conn_dump)
                                            GROUP BY telephone_no)
    The table that is being updated, is in same db, but rest of two tables are from different databases i.e eposload

    >
    UPDATE ASAP.CAP_NW_CONN_DUMP cncd
    SET MS_INIT = ep1.task_status, HANDSET_DEL =
    EL = ep3.task_status,
    ACTIVATION = ep.task_status, MS_UPDT =
    DT = ep2.task_status,
         MS_FNL = ep4.task_status
    ep1.task_status, ep3.task_status, ep.task_status,
    ep2.task_status, ep4.task_status
    FROM eposmig.t_intf_order_task_dtls@eposload ep,
    eposmig.t_intf_order_task_dtls ep1,
    eposmig.t_intf_order_task_dtls ep2,
    eposmig.t_intf_order_task_dtls ep3,
    3, eposmig.t_intf_order_task_dtls ep4,
         eposmig.pos_order_lines@eposload pol
    WHERE cncd.ident_text = pol.telephone_no
    AND ep.task_type LIKE 'ACT%'
    AND ep1.task_TYPE = 'MSOLV-INIT'
    AND ep2.task_TYPE = 'MSOLV-UPDATE'
    AND ep3.task_type = 'MSOLV-FINAL'
    AND ep4.task_type = 'HANDSET-DEL'
    AND ep.ORDER_NBR = pol.ORDER_NBR
    AND ep1.ORDER_NBR = pol.ORDER_NBR
    AND ep2.ORDER_NBR = pol.ORDER_NBR
    AND ep3.ORDER_NBR = pol.ORDER_NBR
    AND ep4.ORDER_NBR = pol.ORDER_NBR
    AND pol.order_line_nbr IN (SELECT MAX(order_line_nbr)
    FROM eposmig.pos_order_lines
    WHERE telephone_no IN (SELECT
    e_no IN (SELECT ident_text FROM
    asap.cap_nw_conn_dump)
                                            GROUP BY telephone_no)
    The syntax of your UPDATE statement is incorrect.
    Have a look at the "wire-diagram" in the documentation -
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10007.htm#SQLRF01708
    and compare it with your UPDATE statement.
    HTH
    isotope

  • Giving error in update query

    This is my update query in oracle but it is giving error:
    Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
    from note_master NM ,
    (     select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc,      NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
    As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA,      (50 * (NORM.Strike_Price_Per/100)) as
    rike_Price_Calc,      (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
    NORM.Nominal_Amount End )as Nominal_Amount_Calc,     (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
    Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc,     (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
    Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc     from      (          select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
    Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
    MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2      from      (          Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
    Currency , Strike_Price_Per,Misc2      from Sample_ADF_FinIQ_Common.Note_Order_RM      Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN'      And RO_ID = 'R000000002'     ) NORM      Group by Note_Master_Id     ) NORM
    Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA     On RSBA.PairCode = (NORM.Asset )          Left Outer JOIN      (     select Note_Master_ID,sum(Nominal_Amount)
    as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA      from Note_Order_RM     
    Where RO_ID <> 'R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set      Price_Updated_YN = 'Y'           ,
    Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc          , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc          ,
    Current_Spot = RESULT1.Spot_Price_Calc           , Published_Spot = RESULT1.Spot_Price_Calc           , Strike_Price = RESULT1.Strike_Price_Calc
    where NM.Note_Master_ID = RESULT1.Note_Master_ID;
    error :
    rror at Command Line:17 Column:105
    Error report:
    SQL Error: ORA-00904: "RESULT1"."STRIKE_PRICE_CALC": invalid identifier
    00904. 00000 - "%s: invalid identifier"
    can anybody help.
    Thanks

    Still one more typo problem exists in you sql stament , equal to(=) operator is missing in your original statement look below
    original
    Where RO_ID 'R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set Price_Updated_YN = 'Y'
    modified
    Where RO_ID='R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set Price_Updated_YN = 'Y' Ok, once try with this code, some syntax prob i modified it.
    Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
    from note_master NM ,
    (     select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc, NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
    As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA, (50 * (NORM.Strike_Price_Per/100)) as
    Strike_Price_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
    NORM.Nominal_Amount End )as Nominal_Amount_Calc,     (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
    Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc,     (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
    Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc     from (      select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
    Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
    MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2 from (      Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
    Currency , Strike_Price_Per,Misc2 from Sample_ADF_FinIQ_Common.Note_Order_RM Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN' And RO_ID = 'R000000002'     ) NORM Group by Note_Master_Id     ) NORM
    Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA     On RSBA.PairCode = (NORM.Asset )      Left Outer JOIN (     select Note_Master_ID,sum(Nominal_Amount)
    as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA from Note_Order_RM     
    Where RO_ID 'R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set Price_Updated_YN = 'Y' ,
    Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc      , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc      ,
    Current_Spot = RESULT1.Spot_Price_Calc , Published_Spot = RESULT1.Spot_Price_Calc , Strike_Price = RESULT1.Strike_Price_Calc
    where NM.Note_Master_ID = RESULT1.Note_Master_ID;Edited by: darkStargate on Dec 8, 2011 7:42 PM

  • MS SQL - Syntax error for valid query

    I have a problem with the second query in this code (gives me
    a syntax error in my HAVING line)
    <cfquery name="getDupes" datasource="#application.ODBC1#"
    dbtype="ODBC" username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT *
    FROM view_FormCount
    WHERE formCount >= 2
    ORDER BY formNum
    </cfquery>
    <cfset variables.lstForms = "">
    <cfoutput query="getDupes">
    <cfset variables.lstForms=
    listAppend(variables.lstForms,"'#getDupes.formNum#'")>
    </cfoutput>
    <cfset variables.whereClause = "(formNum =
    #ReplaceNoCase(variables.lstForms,',',' OR formNum =
    ','ALL')#)">
    <cfquery name="getDetails"
    datasource="#application.ODBC1#" dbtype="ODBC"
    username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    FROM tblForms INNER JOIN tblCompanies ON tblForms.formCustNum
    = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    HAVING #variables.whereClause#
    ORDER BY tblForms.formNum, tblForms.formCustNum
    </cfquery>
    Now, the really odd thing is if I just take the query text
    out of the CFQUERY tags and use CFOUTPUT instead (to see in my
    browser what query is getting executed) I get a query that I can
    paste into Enterprise Mgr and runs fine.
    I can even paste the resulting text into my code in a CFQUERY
    and CF will run it fine.
    In other words, the dynamic version query gives me an error,
    but if I just output the SQL statement, copy-and-paste that into
    the CFQUERY that's erroring out (replacing what's there) to run as
    a static query, it works fine (sample of static query below).
    The error I get when I try to do it dynamically is "Error
    Executing Database Query. [Macromedia][SQLServer JDBC
    Driver][SQLServer]Line 4: Incorrect syntax near '10169318'. The
    error occurred on line 21." which is where the HAVING clause
    starts.
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr FROM tblForms INNER
    JOIN tblCompanies ON tblForms.formCustNum = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName, tblForms.formCustNum,
    tblCompanies.companyAbbr HAVING (formNum = '10169318' OR formNum =
    '1016CONCERTA' OR formNum = '1016NSAIDS' OR formNum =
    '1016STRATTERA' OR formNum = '1016WELLBUTRIN' OR formNum =
    '18504211' OR formNum = '185093807' OR formNum = '73208565' OR
    formNum = '732120027' OR formNum = '7322154' OR formNum = '7323402'
    OR formNum = '7323522' OR formNum = '73238900' OR formNum =
    '7324211' OR formNum = '7324211S' OR formNum = '7324265' OR formNum
    = '73242891' OR formNum = '732434341' OR formNum = '732434342' OR
    formNum = '73243435' OR formNum = '73243436' OR formNum =
    '73243439' OR formNum = '73243440' OR formNum = '73243441' OR
    formNum = '73243442' OR formNum = '73243443' OR formNum = '7324359'
    OR formNum = '7324360' OR formNum = '7324370' OR formNum =
    '7324560' OR formNum = '7324959' OR formNum = '7326411ptreg' OR
    formNum = '7326599' OR formNum = '7326600' OR formNum = '7326620'
    OR formNum = '7326707' OR formNum = '7326931' OR formNum =
    '7328410' OR formNum = '732851031TOP' OR formNum = '7328512' OR
    formNum = '7328548' OR formNum = '7328548P2' OR formNum =
    '7328548P3' OR formNum = '7328548P4' OR formNum = '73289400' OR
    formNum = '73290D' OR formNum = '7329154' OR formNum =
    '73291544JHS' OR formNum = '73291545JHS' OR formNum =
    '73291546JHSMH' OR formNum = '73291547JHSMH' OR formNum = '7329174'
    OR formNum = '7329308' OR formNum = '7329402' OR formNum =
    '7329424' OR formNum = '7329455' OR formNum = '7329520' OR formNum
    = '7329539' OR formNum = '73297701JH' OR formNum = '73298273' OR
    formNum = '73298400' OR formNum = '73298403' OR formNum =
    '73298404' OR formNum = '7329883' OR formNum = '73298860' OR
    formNum = '7329887' OR formNum = '73298974' OR formNum = '7329899'
    OR formNum = '7329899S' OR formNum = '73299190' OR formNum =
    '7329987' OR formNum = '7329999PTO' OR formNum = '732AV5160' OR
    formNum = '732CMHFRAZ' OR formNum = '732HIPAA' OR formNum =
    '732HIPAAFLYERS' OR formNum = '734HEART' OR formNum = '7444711' OR
    formNum = '7449230' OR formNum = '744HR4991' OR formNum =
    '7538014MI' OR formNum = '77511044' OR formNum = '77511045' OR
    formNum = '775stampnochange' OR formNum = '80851001BLUE' OR formNum
    = '80MR4200' OR formNum = '80MR4273' OR formNum = '80MR4274' OR
    formNum = '80MR4300' OR formNum = '80MR9934' OR formNum =
    '80MR9935' OR formNum = '80SHC100' OR formNum = '80SHC4301' OR
    formNum = '80SHC9830' OR formNum = '80SHC9832') ORDER BY
    tblForms.formNum, tblForms.formCustNum

    AWFrueh1808 wrote:
    > OK, that's simple enough. But then I'm really confused
    as to why the query in
    > my original post/example didn't work.
    >
    > The only single quotes in my #whereClause# variable were
    wrapped around each
    > varchar value in the WHERE clause (well, HAVING) as in
    HAVING formNum = '12345'
    > OR formNum = '54321'
    >
    > I never used a single quote within the value itself. And
    yet
    > preservesinglequotes fixed it. So what was CF doing? Why
    did the single
    > quotes still show up in the error msg - and in the right
    place?
    >
    As I said the default behavior is to escape the quotes in
    your variables
    as data. So the default output of your SQL statement, before
    preserveSingleQuotes() would be like this.
    HAVING formNum = ''12345'' OR formNum = ''54321''
    As you can see that is not the desired results in your case.
    In your
    case you have the proper number of single quotes in your
    string and you
    do not want any added. You want to preserve them so to say.
    Thus
    adding preserveSingleQuotes() around your whereClase
    variable, i.e.
    preserveSingleQuotes(whereClause) says do not add any quotes,
    keep them
    all single.

  • Syntax Error in Update Statement

    Would a smart and kind CF pro mind putting a fresh pair of
    eyes on this code and tell me where the syntax error is? All the
    fields in the statement are numeric except the last one (comments).
    I have enclosed them in val() to ensure they are numeric when
    inserted into the DB. The fields they're being inserted into are
    numeric. I need to be numeric because I will be doing calculations
    on them. Also, I have triple-checked to ensure the datasource,
    table, and field names all match.
    Thanks,
    GwenH

    Try using <cfqueryparam>
    <cfquery datasource="reviews">
    UPDATE evals
    SET focus = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.focus#">
    , strengths = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.strengths#">
    , tailored = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.tailored#">
    , badinfo = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.badinfo#">
    , format = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.format#">
    , visual = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.visual#">
    , grammar = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.grammar#">
    , pronouns = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.pronouns#">
    , written = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.written#">
    , achieve = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.achieve#">
    , sell = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.sell#">
    , negative = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.negative#">
    , top = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.top#">
    , general = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.general#">
    , intro = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.intro#">
    , orientation = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.orientation#">
    , paragraphs = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.paragraphs#">
    , two = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.two#">
    , length = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.length#">
    , none = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.none#">
    , comments = <cfqueryparam cfsqltype="cf_sql_clob"
    value="#form.comments#">
    WHERE resumeID = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.resumeID#">
    </cfquery>
    Ken Ford
    Adobe Community Expert Dreamweaver/ColdFusion
    Adobe Certified Expert - Dreamweaver CS3
    Adobe Certified Expert - ColdFusion 8
    Fordwebs, LLC
    http://www.fordwebs.com
    "GwenH" <[email protected]> wrote in message
    news:[email protected]...
    > Would a smart and kind CF pro mind putting a fresh pair
    of eyes on this
    > code
    > and tell me where the syntax error is? All the fields in
    the statement are
    > numeric except the last one (comments). I have enclosed
    them in val() to
    > ensure
    > they are numeric when inserted into the DB. The fields
    they're being
    > inserted
    > into are numeric. I need to be numeric because I will be
    doing
    > calculations on
    > them. Also, I have triple-checked to ensure the
    datasource, table, and
    > field
    > names all match.
    >
    > Thanks,
    > GwenH
    >
    > <cfquery datasource="reviews">
    > UPDATE evals
    > SET
    > focus = val(#form.focus#)
    > , strengths = val(#form.strengths#)
    > , tailored = val(#form.tailored#)
    > , badinfo = val(#form.badinfo#)
    > , format = val(#form.format#)
    > , visual = val(#form.visual#)
    > , grammar = val(#form.grammar#)
    > , pronouns = val(#form.pronouns#)
    > , written = val(#form.written#)
    > , achieve = val(#form.achieve#)
    > , sell = val(#form.sell#)
    > , negative = val(#form.negative#)
    > , top = val(#form.top#)
    > , general = val(#form.general#)
    > , intro = val(#form.intro#)
    > , orientation = val(#form.orientation#)
    > , paragraphs = val(#form.paragraphs#)
    > , two = val(#form.two#)
    > , length = val(#form.length#)
    > , none = val(#form.none#)
    > , comments = '#form.comments#'
    > WHERE resumeID = #form.resumeID#
    > </cfquery>
    >

  • Syntax Error in the Query

    Dear All,
    Please tell me syntax error in the below query. When I'm going to write numeric number in this filed "$[ OVPM.DocNUm ]". It's working fine. But when I'm writing this it give me error.Please clear me where am wrong????I
    SELECT T0.[AcctNum] FROM VPM1 T0 WHERE T0.[DocNum] =$ [OVPM.DocNUm ]
    Regards
    Edited by: Anwar Ali Sohail on Sep 27, 2011 11:43 AM

    HI
    Try This
    SELECT T0.[CheckNum] FROM VPM1 T0  INNER JOIN OVPM T1 ON T0.DocNum = T1.DocEntry WHERE T0.[DocNum] = $[OVPM.DocNum]
    OR
    SELECT T0.[AcctNum] FROM VPM1 T0  INNER JOIN OVPM T1 ON T0.DocNum = T1.DocEntry WHERE T0.[DocNum] = $[OVPM.DocNum]
    Edited by: kambadasan on Sep 27, 2011 4:26 PM

  • Syntax error in ABAP Query

    Hi All,
    We are facing syntax erro with ABAP query.
    We have a infoset/query which is perfectly working in one system and we downloaded the both infoset and query from this system.But the same query when it is uploaded to other system is not working.
    Infoset is not giving any syntax error while activation. Morever, the generated report struture is also different from the other system. In old system, report was having one include for declaration and other for data retrieval process etc.
    Can you please help us to resolve this issue?
    Thanks

    Hi,
    The query generated is based on the table structures available as they are used, etc.
    So please check if there is any difference in the fields available in the tables used, LDB used if any.
    In addition, may be few of the properties of the SAP query and info set does not get copied properly.
    and after activating the info set only, activate the query, etc...check them once again.
    Regards,
    Santhosh.

  • Syntax error in Update Routine

    Dear All,
    While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am defining a variable of type  tys_TG_1-/BIC/ZGROSSPRI.
    For instance,
    DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
    The error is :
    E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
    specified tables nor defined by a "DATA" statement. "DATA" statement.
    Below given is the code which I am using for the same. Kindly advise how to correct this error.
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    Edited by: Suneeth Sebastian on Apr 7, 2010 4:11 PM
    Edited by: Rob Burbank on Apr 7, 2010 1:19 PM

    Dear All,
    While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am trying to define a variable of type tys_TG_1-/BIC/ZGROSSPRI. How is it possible to define a variable of type target field(Infoobject) ?
    For instance,
    DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
    The error is :
    E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
    specified tables nor defined by a "DATA" statement. "DATA" statement.
    tys_TG_1-/BIC/ZGROSSPRI is already defined in the Class section as below
    TYPES:
          BEGIN OF tys_TG_1,
         InfoObject: ZGROSSPRI Gross Price in Statistical Currency.
            /BIC/ZGROSSPRI           TYPE /BIC/OIZGROSSPRI,
          END   OF tys_TG_1.

  • Syntax error in a query

    Hello all
    I have a query, and i got this error , any idea ?
    Error starting at line 1 in command:
    WITH continent_table  AS
    SELECT     en.country,en.continent
            ,ROW_NUMBER() OVER (PARTITION BY en.country ORDER BY en.percent DESC) ran
         FROM     encompasses en
         where ran=1
    select co.name,con.continent,co.population/co.area as pop_density,ec.GDP,pop.Population_Growth,pop.infant_mortality,pol.government
    from country co
    join economy ec
    on co.code=ec.country
    join population pop
    on co.code=pop.country
    join politics pol
    on co.code=pol.country
    join continent_table  con
    on co.code=con.country
    Error at Command Line:6 Column:8
    Error report:
    SQL Error: ORA-00904: "RAN": invalid identifier
    00904. 00000 -  "%s: invalid identifier"
    *Cause:   
    *Action:im using oracle 11g
    thank you in advance
    best,
    david

    >
    So is it still possible to use this selection as a view? because i can run it but i can not use it to create a view
    i think because i have with xx as structure, i don't know
    >
    I don't know either since you didn't post your 4 digit Oracle version. You probably just have an error in your query.
    This works for me using vanilla 11.2.0.1.0:
    create view v_emp as
    WITH q AS
    SELECT empno, deptno, ename
            ,ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY deptno) r_id
        FROM    emp
    q1  AS
    SELECT * from q where r_id < 3
    SELECT * from q1
    select * from v_emp
    EMPNO     DEPTNO     ENAME     R_ID
    7782     10     CLARK     1
    7934     10     MILLER     2
    7369     20     SMITH     1
    7902     20     FORD     2
    7499     30     ALLEN     1
    7521     30     WARD     2

Maybe you are looking for

  • Ipod Classic audiobook settings

    I have placed audiobooks onto my Ipod Classic 160G, I have managed to put into one long book on my Itunes but not on my ipod. It shows each track seperate (and theres roughly 500 tracks per book) and wont skip onto the next one no matter not if I tur

  • Win 8.1 and HP Officejet Pro 8600 not connecting

    Priior to installing Windows 8.1, my printer worked fine.  I installed Windows 8.1 and came across the message - Printer Error - Before you can perform printer-relate tasks...  I removed and reinstalled the printer and it worked.  I printed several d

  • Need help on File uploading in JSF

    Hi All, i have to upload some document into IBM DB2 Content Management using JSF Portlet. Is it possible to upload a document( in my case it is an image) using JSF Portlet into IBM DB2 Content Management? and also i need to keep the reference of the

  • Related to payroll postings-Reports

    Hi all, Can anyone tell me what are the reports used to access Personal number, WBS element, amount and Assignment percentage after doing postings to G/L accounts. Regards, evani

  • Sideloaded Amazon Kindle - where's the app on my PB?

    Hi there, I downloaded Amazon Kindle from Good E Reader. Went fine, opened on my PB after download. However, I'm afraid to close it, as there is no app anywhere! Yes, I've scrolled up, down, left and right, and nothing.  How do I find it? Where could