Help! Syntax Error in SQL statement
Hello. I'm getting an error message and I'm just not seeing
where I went wrong. The SQL statement is:
updateSQL = "UPDATE TrainingHistory SET Status='" &
fFormat(Request.Form(cStatus)) & "', StatusComments='" &
fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
& fFormat(Request.Form(cTrainingID))
The error message is:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in
string in query expression '' WHERE Training_ID=9054'.
I've been looking at it for a while. Not sure where I went
wrong. Here is a more complete version of the code:
<%
Function fFormat(vText)
fFormat = Replace(vText, "'", "''")
End Function
Sub sRunSQL(vSQL)
set cExecute = Server.CreateObject("ADODB.Command")
With cExecute
.ActiveConnection = MM_coldsuncrea_lms_STRING
.CommandText = vSQL
.CommandType = 1
.CommandTimeout = 0
.Prepared = true
.Execute()
End With
End Sub
If Request.Form("action")="update" Then
'Set variables for update
Dim updateSQL, i
Dim cTrainingID, cStatus, cStatusComments
'Loop through records on screen and update
For i = 1 To fFormat(Request.Form("counter"))
'Create the proper field names to reference on the form
cTrainingID = "Training_ID" & CStr(i)
cStatus = "Status" & CStr(i)
cStatusComments = "StatusComments" & CStr(i)
'Create the update sql statement
updateSQL = "UPDATE TrainingHistory SET Status='" &
fFormat(Request.Form(cStatus)) & "', StatusComments='" &
fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
& fFormat(Request.Form(cTrainingID))
'Run the sql statement
Call sRunSQL(updateSQL)
Next
'Refresh page
Response.Redirect("ClassUpdateRoster.asp?Training_ID=") &
(rsClassDetails.Fields.Item("event_ID").Value)
End If
%>
You need another single quote after the double quote before
the WHERE clause. You are not closing the single quote you used to
delimit the value for StatusComments.
Similar Messages
-
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.
% -
Error in SQL Statement: SAPSQL_INVALID_TABLENAME
Hello all,
While displaying contents of infocube i am getting strange error ..
Error in SQL Statement: SAPSQL_INVALID_TABLENAME ABC
Message no. DBMAN256
( Table name length is 16 )
I am able to see the contents of Fact table.
Could not found any solution till now.. Any lights , views will be very much helpful.
Regards
Nimeshhi Nimesh,
check oss note 835816
Symptom
When you execute a query, a data-mart, SEM, APO or similar access, an SQL error 4004 occurs "Unknown table name" Open SQL: Short dump with UNCAUGHT_EXCEPTION CX_RSR_X_MESSAGE in the ABAP Call Stack, you find the RSDRC_BASIC_DB_QUERY_DATA_GET function module.
Prior to this, relatively large datasets (more than 10%) were deleted from the InfoCube.
Other terms
Business Information Warehouse, Factview, DBMAN256, DBMAN
256, SAPLRSDRS, DELETE, DELETE_FACTS, RSDRD_DELETE_FACTS
Reason and Prerequisites
During the purge, the fact tables are rebuilt again as of a certain percentage, for performance reasons. The factview is then not created again.
Solution
Views that are already missing can be compiled again with the SAP_FACTVIEWS_RECREATE report.
The correction prevents the problem reappearing.
BW 3.0B
Import Support Package 27 for 3.0B (BW3.0B Patch27 or SAPKW30B27) into your BW system. The Support Package is available whennote 0723258 with the short text "SAPBWNews BW3.0B Support Package 27", which describes this Support Package in more detail, is released for customers.
BW 3.10 Content
Import Support Package 21 for 3.10 (BW3.10 Patch21 or SAPKW31021) into your BW system. The Support Package is available whennote 0723263 with the short text "SAPBWNews BW3.1 Content Support Package 21", which describes this Support Package in more detail, is released for customers.
BW 3.50
Import Support Package 13 for 3.5 (BW3.50 Patch13 or SAPKW35013) into your BW system. The Support Package is available when note 0765114 with the short text "SAPBWNews BW Support Package 13 NetWeaver'04 Stack 13", which describes this Support Package in more detail, is released for customers.
In urgent cases you can use the correction instructions.
These notes may already be available before the Support Package is released, to make information available in advance. However, the short text then still contains the words "preliminary version". -
Report -Error in SQL Statement
Hi to All,
Whe I ran the report on ODS its giving the following error.
Error Error in SQL Statement:DBIF_RSQL_INVALID-RSQL
Error Error When generating the SQL statement
Error reading the data of Infoprovider ZABCXX
Abort system error in Program SAPLRRK0 and form RSRDR;SRRK0F30-01
Note:ZABCXX is a Multiprovider
Then I identified data type is mismatched for 4 characteristics in ODS , I have changed the data type from Date to Char then deleted the data from ODS and reloaded the six Init packages with different selections.
After reloading I ran the report still same error its showing.
Is any bug in stadard program?
Pls can anyody throw some light on my problem.
Thanks,
Sha.Hi,
Try using transaction code ListCube and see if you are able to see some entries in BW system itself.
Also in RSRT -> Query -> Environment -> Delete old abaps
Also in RSRT -> Query -> Environment -> Generate Queries
And let us know the outoput .
Hope that helps.
Regards
Mr Kapadia
Assigning points is the way to say thanks in SDN. -
RMAN-10006: error running SQL statement: alter session set remote_dependenc
Backups are failing with following error
RMAN-00554: initialization of internal recovery manager package failed
RMAN-12001: could not open channel default
RMAN-10008: could not create channel context
RMAN-10002: ORACLE error: ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must be from among MANUAL, AUTO
RMAN-10006: error running SQL statement: alter session set remote_dependencies_mode = signature
Not able to change to signature
SQL> alter session set remote_dependencies_mode=signature;
ERROR:
ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must
be from among MANUAL, AUTO
I dont see MANUAL or AUTO as valid value for this parameter (http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch1175.htm#1023124) DB version is 9.2.0
Parameter type
String
Syntax
REMOTE_DEPENDENCIES_MODE = {TIMESTAMP | SIGNATURE}
Default value
TIMESTAMP
Parameter class
Dynamic: ALTER SESSION, ALTER SYSTEM
=======================================
I believe it could be because of following bug
"A PRE-PATCHED ORACLE IMAGE CAN BE INSTALLED IN MEMORY "
Refer: "https://metalink2.oracle.com/metalink/plsql/f?p=130:15:1613505143885559758::::p15_database_id,p15_docid,p15_show_header,p15_show_help,p15_black_frame,p15_font:BUG,4610411,1,1,1,helvetica"
I appreciate your effort in fixing this issue.
Edited by: user10610722 on Nov 25, 2008 4:37 PMHi:
It seems when you are starting RMAN it's executing some commands (one 'ALTER SESSION...'. It's seems to be a batch which has a bad value for SORT_AREA_SIZE. Find it and modify to a proper value as message shows. If you can't find start RMAN by calling directly the executable ($ORACLE_HOME/bin/rman or %ORACLE_HOME%/bin/rman.exe). -
Error in SQL Statement: SAPSQL_INVALID_FIELDNAME F~/BIC/ZREVISQTY
Dear Guys,
Regards..In the "Listcube" transaction and "Manage Contents" of the cube,whenver i execute the transaction to get the 'Output List' ,i get the following error : " Error in SQL Statement : SAPSQL_INVALID_FIELDNAME"..with the following obj : ZREVISQTY............But when i remove the "ZREVISQTY" from the selection screen in both "LISTCUBE" and "MANAGE" of the cube,the output works fine......It would be great if somone can throw light on this...........
Manythanks
ArunDear Guys,
Regards..In the "Listcube" transaction and "Manage Contents" of the cube,whenver i execute the transaction to get the 'Output List' ,i get the following error : " Error in SQL Statement : SAPSQL_INVALID_FIELDNAME"..with the following obj : ZREVISQTY............But when i remove the "ZREVISQTY" from the selection screen in both "LISTCUBE" and "MANAGE" of the cube,the output works fine......It would be great if somone can throw light on this...........
Manythanks
Arun -
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,
mirkokrugA 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 -
Hi,
Can anyone see why I am getting this error message for my SQL query?
WITH SKU_DATA AS (
SELECT /*+ MATERIALIZE */ DISTINCT FROM_LOC_ID,
SKU_ID,
DESCRIPTION,
UPDATE_QTY,
ORDER_ID,
CONSIGNMENT,
WEIGHT,
PALLET_ID,
CASE
WHEN Upd_Qty_Ratio < 1
THEN TO_CHAR(UPDATE_QTY) || 'U'
WHEN TRUNC(Upd_Qty_Ratio) = Upd_Qty_Ratio
THEN TO_CHAR(Upd_Qty_Ratio) || 'C'
ELSE TO_CHAR(TRUNC(UPDATE_QTY)) || 'C' || ' ' || TO_CHAR(ROUND(MOD(Upd_Qty_Ratio, 1) * USER_DEF_NUM_3, 6)) || 'U'
END CU_Sum
FROM (
SELECT DISTINCT
FROM_LOC_ID,
S.SKU_ID,
S.DESCRIPTION,
ITL.UPDATE_QTY,
S.USER_DEF_NUM_3,
OH.ORDER_ID,
ITL.CONSIGNMENT,
ITL.PALLET_ID,
NVL(ITL.UPDATE_QTY,0)*NVL(S.EACH_WEIGHT,0) Weight,
ITL.UPDATE_QTY/(CASE S.USER_DEF_NUM_3 WHEN 0 THEN 1 ELSE S.USER_DEF_NUM_3 END) Upd_Qty_Ratio
FROM INVENTORY_TRANSACTION ITL, SKU S, LOCATION L, ORDER_HEADER OH
WHERE ITL.SKU_ID = S.SKU_ID
AND ITL.CODE = 'Pick'
AND ITL.CONSIGNMENT = $P{Consignment}
AND OH.ORDER_DATE = TO_CHAR($P{Date}, 'DD-Mon-YYYY')
AND OH.ORDER_ID = ITL.REFERENCE_ID
AND ITL.TO_LOC_ID = 'CONTAINER'))
SELECT DISTINCT ORDER_ID, CONSIGNMENT, WEIGHT, PALLET_ID, CU_Sum,
(SELECT NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'U') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'C',NULL) END)),'0') ||'C' || ' ' || NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'C') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'U',NULL) END)),'0') ||'U' FROM SKU_DATA) AS Total_Cu_Sum
FROM SKU_DATAThanks in advance.
SM.Hi Sean,
It is saying error executing SQL statement, but with no "ORA error" so maybe its a Jasper Reports error i'm not too sure.
And this is a different version of the one we done together, that one is running fine just having problems putting the jasper file on to the server. I'm just using the main bits from the original SQL.
SM -
Hi ,
I am working on SAP BW 3.5.
while downloading the records through infospoke and giving them to the Application server side, I am getting an error "Error in SQL Statement: DBIF_RSQL_INVALID_RSQL".
Daily the Infospoke runs on delta mode. But for downloading of few records i have deactivated the delta and changed it in to Full mode. After downloading the data I again Activated the delta.but while Executing on Background mode I am getting an error mentioned above.
can anyone please suggest a solution for resolving this error?
Thanks in advance.
Santosh.Hi:
Did you do some recent change in the objects?. I face sometimes this error and it is due to misalignment among the objects in a data flow (cubes, DSOs, transformations, DTPs, etc.).
What you can do is activate everything again.
Best regards. -
SQL error, Error in SQL statement
hi all,
in our project we are using 0SD_C03. while i creating aggrigates it's showining "SQL error" and Error in SQL statement.
please provide me some inputs.
sasidharcheck:
Aggregate issue
Problems with BITMAPINDEX under ORACLE in BW
SAP Note Number: 159779
No 'Star Transformation' for a Hierarchy Changerun
SAP Note Number: 934281 -
Error in SQL Statement (ODS data loading Error)
Hello Gurus...
I am trying to loading the data Info Source To ODS in my ODS Key Figure Z_IVQUA (Invoice Quantity)
is getting the Error Message Data shows 0 from 0 Records.
I was Remove the Key Field from ODS Then try to load the data but i am getting same Error..
Error in SQL Statement: SAPSQL_INVALID_FIELDNAME F~/BIC/Z_INVQUA
Errors in source system
Please Suggest....
Thanks
PrakashHello All...
Really appreciate if you can give me some advise. Thanks.
Prakash
Edited by: Prakash M on Jan 14, 2009 2:14 PM -
Error in SQL Statement: SAPSQL_INVALID_TABLENAME /BI0/V0FIGL_C01F
Hi,
When I am executing datasource 80FIGL_C01 using T.code RSA3 in BW3.5, getting error Error in SQL Statement: SAPSQL_INVALID_TABLENAME /BI0/V0FIGL_C01F
I am getting same error when pulling data from BW3.5 to BI7.0 at scheduling.
Can I have your valuable insights on this.
Thanks in advance!
SapnaHi,
Try the report sap_factviews_recreate. Warning: the program generate the views for all infocubes. When you don't want to do this, debug the abap and delete the infocubes from the table G_T_CUBE.
Or activate the infocube and re-generate the datasource.
Sven -
Hi Everyone,
I would like to create an error package say PKG_ERROR that has a procedure say LOG_ERROR. The LOG_ERROR procedure will basically logs the following in a table
ERROR_ID
-> SEQ_ERROR_ID.NEXTVAL
CREATED_DATE
-> SYSDATE
HOST_NAME
-> SELECT sys_context('USERENV', 'HOST') FROM dual;
IP_ADDRESS
-> SELECT sys_context('USERENV', 'IP_ADDRESS') FROM dual;
OS_USER
-> SELECT sys_context('USERENV', 'OS_USER') FROM dual;
SESSION_USER
-> SELECT sys_context('USERENV', 'SESSION_USER') FROM dual;
SCHEMA_NAME
-> SELECT sys_context('USERENV', 'CURRENT_SCHEMA') FROM dual;
ERROR_CODE
-> SQLCODE
ERROR_MESSAGE
-> SQLERRM
ERROR_STACK
-> DBMS_UTILITY.FORMAT_ERROR_STACK
CALL_STACK
-> DBMS_UTILITY.FORMAT_CALL_STACK
SQL_STATEMENT
-> ????
My problem now is how to get the SQL_STATEMENT that caused the error.
I'll be using the PKG_ERROR.LOG_ERROR procedure as follows:
PROCEDURE SP_TEST
IS
v_NUMBER NUMBER;
BEGIN
SELECT 1 / 0
INTO v_NUMBER
FROM DUAL;
EXCEPTION
WHEN OTHERS THEN
PKG_ERROR.LOG_ERROR(param_1, param_N);
END PROCEDURE SP_TEST;
I tried numerous codes and place them on the PKG_ERROR.LOG_ERROR procedure but to no avail:
#1
-- did not return the ERROR'd SQL Statement
SELECT q.sql_text
INTO captured_sql
FROM gv$sql q, gv$sql_cursor c, gv$session s
WHERE s.audsid = USERENV('sessionid')
AND s.prev_sql_addr = q.address
AND q.address = c.parent_handle;
#2
-- Only works in Database Error Trigger (I would like a solution via Package)
DECLARE
l_text ora_name_list_t;
l_n number;
BEGIN
dbms_output.put_line( '--------------------' );
dbms_output.put_line('statment causing error: ' );
l_n := ora_sql_txt( l_text );
FOR i in 1 .. nvl(l_text.count,0)
LOOP
dbms_output.put_line(l_text(i) );
END LOOP;
dbms_output.put_line( 'error text: ' );
FOR i IN 1 .. ora_server_error_depth
LOOP
dbms_output.put_line(ora_server_error_msg(i) );
END LOOP;
dbms_output.put_line( '--------------------' );
END;
#3
-- as per PSOUG it is returns the first 4K bytes of the current SQL that triggered the fine-grained auditing event. (I'm not using FGA)
SELECT sys_context('USERENV', 'CURRENT_SQL') FROM dual;
Is it possible??
Thanks,
Henry Wu<My problem now is how to get the SQL_STATEMENT that caused the error.>
We use a location variable that indicates where in a program the error occurred, something like
variable v_location_c VARCHAR2(10);
v_location_c := '1000000000';
UPDATE ...
EXCEPTION
WHEN OTHERS THEN
log_error('program_name',user,v_location_c, ...) -
Incorrect syntax errors in sql server function. Please help.
This is my sql server function:
create function dbo.CleanTheStringAdv (@theString nvar
char(500), @CleanMode as int)
returns nvarchar(500)
begin
--define variables
declare @strAlphaNumeric nvarchar(500)
declare @i int
declare @strChar nvarchar(500)
declare @CleanedString nvarchar(500)
--initiate values
set @CleanedString =''
set @theString = @theString + ''
SET @i = 1
--Determine if we are looking for numeric values only or numbers and letters
return case @CleanMode
WHEN 1
THEN @strAlphaNumeric = '0123456789'
WHEN 2
THEN @strAlphaNumeric = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
WHEN 3
THEN @strAlphaNumeric = '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
else 0
end
--Search through chars in the string passed to the function
while (@i <= Len(@theString))
begin
@strChar = substring(@theString, @i, 1)
If (charindex(@strAlphaNumeric, @strChar) <>0)
--if the current char being reviewed is valid then add it to the new string
begin
@CleanedString = @CleanedString + @strChar
end
end
return @CleanedString
and below are the syntax errors I see when I press F5:
Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 24
Incorrect syntax near '='.
Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 39
Incorrect syntax near '@strChar'.
Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 43
Incorrect syntax near '@CleanedString'.
Any help is highly appreciated.....Here is the full code for the function:
create function dbo.CleanTheStringAdv (@theString nvarchar(500), @CleanMode as int)
returns nvarchar(500)
as
begin
--define variables
declare @strAlphaNumeric nvarchar(500)
declare @i int
declare @strChar nvarchar(500)
declare @CleanedString nvarchar(500)
--initiate values
set @CleanedString =''
set @theString = @theString + ''
SET @i = 1
--Determine if we are looking for numeric values only or numbers and letters
SET @strAlphaNumeric = case @CleanMode
WHEN 1
THEN '0123456789'
WHEN 2
THEN '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
WHEN 3
THEN '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
else 0
end
--Search through chars in the string passed to the function
while (@i <= Len(@theString))
begin
set @strChar = substring(@theString, @i, 1);
If (charindex(@strAlphaNumeric, @strChar) <>0) --if the current char being reviewed is valid then add it to the new string
begin
SET @CleanedString = @CleanedString + @strChar;
end
END
return @CleanedString;
END -
Pleasse help me with this error in SQL statement
Please tell me the error in this query:
the Error given is
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement
given :
Databse is MS Access
In the databse :
account - text
number - text
date - date/time
vendor - text
Connection connection = t.getConnection();
/* t - some object containing a connection*/
Statement stmt = connection.createStatement();
stmt.executeUpdate("INSERT INTO Bills (account, number, date, vendor)
VALUES ('vai', '23', 10/12/2006, 'jaadya')");I would imagine the problem is with the date. Different DBs have different date formats. To avoid that problem, use a PreparedStatement.
java.sql.Date date = ...;
PreparedStatement ps = con.prepareStatement("INSERT INTO Bills (account, number, date, vendor) VALUES (?, ?, ?, ?)");
ps.setString(1, "vai");
ps.setString(2, "23);
ps.setDate(3, date);
ps.setString(4, "jaadya");
ps.executeUpdate();This saves you from having to deal with vendors' various date formats, keeps you from having to escape special characters in strings, and prevents SQL injection.
Maybe you are looking for
-
Gmail Buttons Not Working In Safari 6.0.5
The Archive, Spam, Delete and Mark As Read buttons don't work in Safari 6.0.5 any more (OSX 10.8.4). I've enabled the Developer Menu, cleared the cache, no better. Anyone got any ideas? Having to use the Gmail app on my iPhone at the mo!
-
Read file : File name conatins the Time stamp from payload
Hi I have to scenario where i am creating file name based on the payload field ( Date/time), theni have to pick up the files based on the File Name : Ex: 0212200910:01:02 0212200910:01:03 0212200910:01:01 then the sender adapter shoul
-
Transfer of WBS to Operative Structure
Dear Experts. I have come across a unique scenario where i have a WBS element which is carrying actual cost and commitment cost in it. Now the user needs this WBS element to be transfered to other operative project. Do we have any way where we can tr
-
IDVD crashes on my iMac 24'' with Leopard
However, iDVD crashes on my iMac 24'' (old version). It works fine on my MacBook. I tried a lot of things including reinstalling and updating to Leopard 10.5.1 and iDVD 7.0.1. But still is crashing after start. As I would like to burn my marriage I r
-
Im developing a jsp application with bc4j using jdev 10g. I have a problem with viewobjects in the application module suddenly becoming null. It doesn't happen every time and it seems to depend on the computer environment as well. It works fine in t