Sql date time insert error

Hi i am having trouble entering a date in to a sql stored
procedure.
first i convert the date to the users current datetime using
<cfscript>
userTZ="#qGetClubDetails.LocalTime12#"; // or whatever tz ID
you need
tz=createObject("component","timeZone");
userDateTime=tz.castFromServer(today,userTZ);
</cfscript>
then i need to insert this into a stored procedure using
<cfstoredproc procedure="xsp_InsertSmsRecords"
datasource="#application.ds#">
<cfprocparam type="In" cfsqltype="CF_SQL_DATETIME"
dbvarname="UsersDate" value="#CREATEODBCDATETIME(userDateTime)#"
null="No">
</cfstoredproc>
but i am getting a error of
Macromedia][SQLServer JDBC Driver][SQLServer]Error converting
data type varchar to datetime.
any ideas what i need to do?

quote:
Originally posted by:
craiglaw98
ok i have tried that with no luck, i did a cfdump on
userDateTime and i got
{ts '2008-01-21 05:16:04'}
any ideas what i need to do to insert this to sql server
Looks ok to me. To troubleshoot this, try using cfquery for
your insert instead of a stored procedure.

Similar Messages

  • Invalid date/time value error

    I downloaded a trial version of Acrobat XI Pro when I try to save or edit and resave a document I get 'invalid date/time value', error.  I presume it's set for the US and not the UK, can you tell me where I can change the date/time format?
    I'm running on Windows 7

    Hi Rave
    Susan's on leave at the moment so I'm replying on her behalf in the vain hope we can sort things before she gets back and before the trial period runs out!  I'm not sure I understand what you mean by column of date and time - we have a review date in the Word document before we pdf but that's all.  Yes we are saving to a sharepoint server.
    Thanks

  • Sql date time

    hi i have a date time field in ms sql server 2005
    i have 2 form fields i need to insert into the datetime
    i am using CAST(@SchDateTime AS DATETIME) to convert my
    datetime from
    #DateFormat("#form.SMS_Date# #form.SMS_Time#",'dd/mm/yyyy
    hh:mm:ss')#
    but the time is not inserting correctly any ideas how i
    insert 2 form fields into sql ?
    many thanks

    KeithLaw999 wrote:
    > the time is not inserting correctly
    What does not correctly mean?
    > #DateFormat("#form.SMS_Date#
    #form.SMS_Time#",'dd/mm/yyyy hh:mm:ss')#
    DateFormat parses a date value (not a date and time). It uses
    US date formats. So "12/2/2007" will be considered December 2nd,
    not February 12th. Also, is your time using a 12-hour or 24-hour
    clock? It its a 12-hour clock sql server might assume AM, unless
    you included a time marker (ie AM or PM).
    > am using CAST(@SchDateTime AS DATETIME) to convert my
    datetime
    Convert() provides more control, but I don't know if
    dd/mm/yyyy hh:mm:ss is one of the supported styles. An alternative
    is to use CF to parse the strings into a valid datetime object
    first, instead of passing a string to sql server and letting it do
    the parsing.

  • Poblem with java.sql.Date while inserting to a table

    Hi All,
    I have a PostgreSQL database table which contains fields(columns ) of type date. I want to insert values to the table in the[b] �dd-MMM-YYYY� format using the prepared statement.
    My code is as follows
    java.text.DateFormat dateFormatter =new java.text.SimpleDateFormat("dd-MMM-yyyy");
    String formatedDate=dateFormatter.format(theDate);
    currentDate = new java.sql.Date(dateFormatter.parse(formatedDate).getTime())
    �������������������
    �������������������
    �������������������
    pst.setDate(12,currentDate);The problem is the currentDate variable gives date only in the �YYYY-MMM-dd� format but requirement is the currentDate variable should give date in the �dd-MMM-YYYY� format and this should be save to table as java.sql.Date type
    There is any solution???? please help me...
    Thanks and Regards,
    Hyson_05

    Hi,
    What are you talking about? A Date does always wrap a millisecond value, and doesn't have any formatting. It's the database, or your program which formats the date that you see.
    In short. You should format the value when you print it, and not when you store it.
    Kaj

  • Convert Data type from Oracle Data time string to SQL Date time data type

    I have a time stamp column pulled from oracle into a SQL server db table varchar datatype column.
    Now i want to change that column to date time.
    Following is the data present in the table:
    01-APR-11 02.15.00.026000 AM -08:00
    01-APR-11 04.15.00.399000 AM -08:00
    01-APR-11 06.15.00.039000 AM -08:00
    I want to convert this data into sql server datetime data type.
    Please advice.
    Thanks,
    Sam.
    I am unable to find the solution in other sites which is why I have posted it in Oracle forum for seeking solution.
    Thanks in Advance.
    Sam.

    Sam,
    How are you actually loading the data into SQL*Server - are you using something like an Oracle gateway, BCP or another Microsoft utility of some sort ?
    If you are using an Oracle problem then we may be able to help but if using a Microsoft utility then you should really follow up with Microsoft to know what format the data should be in to use a Microsoft utility.
    Regards,
    Mike

  • 2nd gen ipod touch date&time setting error

    when i try to upgrade apps from app store, it says cannot connect to the store.
    a secure connection could not be established. please check date&time setting.
    what should i do?

    Head to Settings -> General -> Date & Time, and make sure the Time is set correctly or the Set Automatically option is set to On.
    B-rock

  • Oracle SQL- Date/Time Help

    Hi I have a query that generates a roster report.
    The issue I am having is how do I create a query the runs off the start and end time.
    What I mean by this is, no matter what time of the day it is, I want the query to run based off of the between time of start and end, if that makes sense.
    Below is an example, notice the double entry, (and yes it is correct) the issue is that both these records get picked up, I would like my query to be based off what the time of day is.
    If it is 12PM, to send 1st record, if its 1:46 pm, to send 2nd record, not both.
    Any help... please
    Employee ID First Last Unit Abr Staffing Start Dt Staffing End DT wstat_name_ch wstat_type_no_in
    '015428'     Jason     Xi     'P23'     '2012-09-10 11:45:00.000'     '2012-09-11 11:45:00.000'     'Regular Duty'          3
    '015428'     Jason     Xi     'P77'     '2012-09-10 13:45:00.000'     '2012-09-11 11:45:00.000'     'Regular Duty'          1
    --My query for above statement.
    SELECT DBA.Resource_Master_Tbl.RscMaster_EmployeeID_Ch,
    DBA.Resource_Master_Tbl.RscMaster_FName_Ch, DBA.Resource_Master_Tbl.RscMaster_LName_Ch, DBA.unit_tbl.unit_abrv_ch,
    DBA.staffing_tbl.staffing_start_dt, DBA.staffing_tbl.staffing_end_dt, DBA.wstat_cde_tbl.wstat_name_ch, DBA.wstat_cde_tbl.wstat_abrv_ch,
    DBA.wstat_cde_tbl.wstat_type_no_in
    FROM DBA.resource_tbl, DBA.Resource_Master_Tbl, DBA.staffing_tbl, DBA.wstat_cde_tbl, DBA.position_tbl, DBA.unit_tbl
    WHERE DBA.resource_tbl.RscMaster_No_In = DBA.Resource_Master_Tbl.RscMaster_No_In AND DBA.resource_tbl.rsc_no_in = DBA.staffing_tbl.rsc_no_in AND
    DBA.staffing_tbl.wstat_no_in = DBA.wstat_cde_tbl.wstat_no_in AND DBA.staffing_tbl.pos_no_in = DBA.position_tbl.pos_no_in AND
    DBA.position_tbl.unit_no_in = DBA.unit_tbl.unit_no_in AND (DBA.staffing_tbl.staffing_start_dt <= NOW()) AND
    (DBA.staffing_tbl.staffing_end_dt >= NOW()) AND (DBA.wstat_cde_tbl.wstat_type_no_in = 1 OR
    DBA.wstat_cde_tbl.wstat_type_no_in = 3)
    GROUP BY DBA.Resource_Master_Tbl.RscMaster_EmployeeID_Ch, DBA.Resource_Master_Tbl.RscMaster_FName_Ch,
    DBA.Resource_Master_Tbl.RscMaster_LName_Ch, DBA.unit_tbl.unit_abrv_ch, DBA.wstat_cde_tbl.wstat_name_ch, DBA.wstat_cde_tbl.wstat_abrv_ch,
    DBA.staffing_tbl.staffing_start_dt, DBA.staffing_tbl.staffing_end_dt, DBA.wstat_cde_tbl.wstat_type_no_in
    ORDER BY DBA.Resource_Master_Tbl.RscMaster_FName_Ch

    958211 wrote:
    Hi I have a query that generates a roster report.
    The issue I am having is how do I create a query the runs off the start and end time.
    What I mean by this is, no matter what time of the day it is, I want the query to run based off of the between time of start and end, if that makes sense.
    Below is an example, notice the double entry, (and yes it is correct) the issue is that both these records get picked up, I would like my query to be based off what the time of day is.
    If it is 12PM, to send 1st record, if its 1:46 pm, to send 2nd record, not both.
    Any help... please
    Employee ID First Last Unit Abr Staffing Start Dt Staffing End DT wstat_name_ch wstat_type_no_in
    '015428'     Jason     Xi     'P23'     '2012-09-10 11:45:00.000'     '2012-09-11 11:45:00.000'     'Regular Duty'          3
    '015428'     Jason     Xi     'P77'     '2012-09-10 13:45:00.000'     '2012-09-11 11:45:00.000'     'Regular Duty'          1
    --My query for above statement.
    SELECT DBA.Resource_Master_Tbl.RscMaster_EmployeeID_Ch,
    DBA.Resource_Master_Tbl.RscMaster_FName_Ch, DBA.Resource_Master_Tbl.RscMaster_LName_Ch, DBA.unit_tbl.unit_abrv_ch,
    DBA.staffing_tbl.staffing_start_dt, DBA.staffing_tbl.staffing_end_dt, DBA.wstat_cde_tbl.wstat_name_ch, DBA.wstat_cde_tbl.wstat_abrv_ch,
    DBA.wstat_cde_tbl.wstat_type_no_in
    FROM DBA.resource_tbl, DBA.Resource_Master_Tbl, DBA.staffing_tbl, DBA.wstat_cde_tbl, DBA.position_tbl, DBA.unit_tbl
    WHERE DBA.resource_tbl.RscMaster_No_In = DBA.Resource_Master_Tbl.RscMaster_No_In AND DBA.resource_tbl.rsc_no_in = DBA.staffing_tbl.rsc_no_in AND
    DBA.staffing_tbl.wstat_no_in = DBA.wstat_cde_tbl.wstat_no_in AND DBA.staffing_tbl.pos_no_in = DBA.position_tbl.pos_no_in AND
    DBA.position_tbl.unit_no_in = DBA.unit_tbl.unit_no_in AND (DBA.staffing_tbl.staffing_start_dt <= NOW()) AND
    (DBA.staffing_tbl.staffing_end_dt >= NOW()) AND (DBA.wstat_cde_tbl.wstat_type_no_in = 1 OR
    DBA.wstat_cde_tbl.wstat_type_no_in = 3)
    GROUP BY DBA.Resource_Master_Tbl.RscMaster_EmployeeID_Ch, DBA.Resource_Master_Tbl.RscMaster_FName_Ch,
    DBA.Resource_Master_Tbl.RscMaster_LName_Ch, DBA.unit_tbl.unit_abrv_ch, DBA.wstat_cde_tbl.wstat_name_ch, DBA.wstat_cde_tbl.wstat_abrv_ch,
    DBA.staffing_tbl.staffing_start_dt, DBA.staffing_tbl.staffing_end_dt, DBA.wstat_cde_tbl.wstat_type_no_in
    ORDER BY DBA.Resource_Master_Tbl.RscMaster_FName_ChFor your own sanity, you should learn to format your code. For the sanity of those of whom you are requesting assistance, you should preserve that formatting with the use of the code tags
    SELECT
        DBA.Resource_Master_Tbl.RscMaster_EmployeeID_Ch,
        DBA.Resource_Master_Tbl.RscMaster_FName_Ch,
        DBA.Resource_Master_Tbl.RscMaster_LName_Ch,
        DBA.unit_tbl.unit_abrv_ch,
        DBA.staffing_tbl.staffing_start_dt,
        DBA.staffing_tbl.staffing_end_dt,
        DBA.wstat_cde_tbl.wstat_name_ch,
        DBA.wstat_cde_tbl.wstat_abrv_ch,
        DBA.wstat_cde_tbl.wstat_type_no_in
    FROM
        DBA.resource_tbl,
        DBA.Resource_Master_Tbl,
        DBA.staffing_tbl,
        DBA.wstat_cde_tbl,
        DBA.position_tbl,
        DBA.unit_tbl
    WHERE
        DBA.resource_tbl.RscMaster_No_In = DBA.Resource_Master_Tbl.RscMaster_No_In
    AND DBA.resource_tbl.rsc_no_in = DBA.staffing_tbl.rsc_no_in
    AND DBA.staffing_tbl.wstat_no_in = DBA.wstat_cde_tbl.wstat_no_in
    AND DBA.staffing_tbl.pos_no_in = DBA.position_tbl.pos_no_in
    AND DBA.position_tbl.unit_no_in = DBA.unit_tbl.unit_no_in
    AND (DBA.staffing_tbl.staffing_start_dt <= NOW())
    AND (DBA.staffing_tbl.staffing_end_dt >= NOW())
    AND (DBA.wstat_cde_tbl.wstat_type_no_in = 1
         OR
         DBA.wstat_cde_tbl.wstat_type_no_in = 3)
    GROUP BY
        DBA.Resource_Master_Tbl.RscMaster_EmployeeID_Ch,
        DBA.Resource_Master_Tbl.RscMaster_FName_Ch,
        DBA.Resource_Master_Tbl.RscMaster_LName_Ch,
        DBA.unit_tbl.unit_abrv_ch,
        DBA.wstat_cde_tbl.wstat_name_ch,
        DBA.wstat_cde_tbl.wstat_abrv_ch,
        DBA.staffing_tbl.staffing_start_dt,
        DBA.staffing_tbl.staffing_end_dt,
        DBA.wstat_cde_tbl.wstat_type_no_in
    ORDER BY
        DBA.Resource_Master_Tbl.RscMaster_FName_ChI'm not sure the above is even legal Oracle SQL. Are you sure you aren't taking code from some other rdbms?

  • Date/Time in SQL

    Hey,
    I'm trying to get CF to put the date or date/time into the SQL 2000 date/time field by using Toolbox insert record form wizard. Then use the date picker on the date field.
    my error was
    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
    the SQL date/time field is 8 characters long, so, I don't know the best way to go about shoving a date/time into it in CF.
    Thanks in advance!

    Hi Kenneth,
    I´m by no means a CF expert, but...
    the SQL date/time field is 8 characters long, so, I don't know the best way to go about shoving a date/time into it in CF
    ...do your ADDT Control Panel´s *database* "Date format" and "Time formats" settings match the required SQL 2000 date/time format ?
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Insert current date/time problem in ViewObject

    Hi!
    I'm trying to setAttribute to a Date type field.
    I have a method:
    public String getCurrDateString() throws ParseException, java.sql.SQLException {
    SimpleDateFormat formatter = new SimpleDateFormat ("dd-MMM-yyyy hh:mm:ss aa");
    Date currentTime_1 = new Date();
    return formatter.format(currentTime_1);
    All the time i call this method such as:
    HistoryViewImpl histVO=getHistoryView();
    Row r=histVO.createRow();
    r.setAttribute("Entrydatetime",cp.getCurrDateString());
    I get oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value:19-Jun-2002 10:14:33 AM
    the strange thing is, that Oracle recognizes this kind of format, because if I use different pattern such as "yyyy-MM-dd", which returns string "2002-06-19", r.setAttribute("Entrydatetime",cp.getCurrDateString()) method works fine and in Oracle table field we have inserted value 19-Jun-2002 12:00:00 PM. The problem is, that i don't need 12:00:00 PM as a time, i need current time.
    What am i doing wrong? Or does it mean that oracle.jbo.domain.Date doesn't know format "dd-MMM-yyyy hh:mm:ss aa"?

    Hi!
    I'm trying to setAttribute to a Date type field.
    I have a method:
    public String getCurrDateString() throws ParseException, java.sql.SQLException {
    SimpleDateFormat formatter = new SimpleDateFormat ("dd-MMM-yyyy hh:mm:ss aa");
    Date currentTime_1 = new Date();
    return formatter.format(currentTime_1);
    All the time i call this method such as:
    HistoryViewImpl histVO=getHistoryView();
    Row r=histVO.createRow();
    r.setAttribute("Entrydatetime",cp.getCurrDateString());Instead of passing in the "String" pass the date object as is. oracle.jbo.domain.Date should be able to convert java.sql.Date/Time/Timestamp and store the time bits as set.
    If you have to pass in string, then establish a Formatter on the attribute with appropriate date format and then use the AttributeHints interface from the relevant AttributeDef object on the row to parse the input String into a valid parsed object that you can set into the row.
    (See oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeInRow() method for a complete usage - source in bc4j\src\bc4juisrc.zip)
    I get oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value:19-Jun-2002 10:14:33 AM
    the strange thing is, that Oracle recognizes this kind of format, because if I use different pattern such as "yyyy-MM-dd", which returns string "2002-06-19", r.setAttribute("Entrydatetime",cp.getCurrDateString()) method works fine and in Oracle table field we have inserted value 19-Jun-2002 12:00:00 PM. The problem is, that i don't need 12:00:00 PM as a time, i need current time.
    What am i doing wrong? Or does it mean that oracle.jbo.domain.Date doesn't know format "dd-MMM-yyyy hh:mm:ss aa"?

  • Date/Time erros when working with Database Connectivity toolkit

    Hi!,
    We are observing errors with date/time when working with LV. The error occurs when the system datetime format is set such that day precedes month (e.g. dd/mm/yyyy). Our VI uses LV 7.1, Database Connectivity 1.0 and SQL Server 2000 on a Win2000 machine.
    Problem details
    Our database in SQL server has a table having columns with data type "datetime"
    If the system date format (as set in control panel) is "mm/dd/yyyy", the 'insert into database' vi works fine. This function inserts the date and time (among other things) into the above mentioned table.
    However, when the system datetime is set to dd/mm/yyyy we start receiving error that date and time is beyond range for dates in which the date had the day field greater than 12 (e.g. 23/10/2005). With the same settings, if the date is such that day field is equal or less than 12 (e.g. 03/10/2005), we do not receive an error but the date is interpreted as 10 March 2005 rather than 03 September 2005.
    Clearly LV (or is it SQL) is mistaking the day field as month.
    We have taken care that when sending and receiving date, the format date and time string is set as per system settings.
    Thus, if system setting is "dd/mm/yyyy" our format string is "%d/%m/%Y"
    And if the setting is "mm/dd/yyyy" our format string is"%m/%d/%Y"
    Any help on problem cause and cure is welcome.
    Thanks,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

    Hi Xu,
    You answer led me to some very interesting fact finding on how SQL server handles date and time. I have attached a zip file which contains webpages that throw more light on this issue.
    The attached pages tell me that SQL has an inbuilt date/time reference format. The default in mm/dd/yyyy. Which explains why my VI worked when I used that format to write to SQL.
    However there is a catch:
    SQL expects the date/time to be in its inbuilt reference format when you WRITE data to SQL. If the date/time is in a different format, better tell SQL about it by using say the SET command you mentioned.
    BUT what about the date/time format when you are reading data from SQL?
    Our finding is that SQL sends date/time string in the system date format when you READ from SQL !!! That is very surprising behaviour (why differentiate between write and read?).
    Is our finding correct?
    So, we adopted the following simple strategy (yet to be fully tested):
    1) Whenever we write date/time to SQL, the string is formatted as mm/dd/yyyy. Presently, the user's SQL server is in the default state. Caveat is that if the user changes SQL date/time from default (which is mm/dd/yyyy) to anything else, our software will give errors. But then he changed it  ;-)
    2) When we read date/time from SQL we format the string as per system date/time format.
    I know this is not very robust coding. But assuming the user keeps his SQL in the current setting, should we expect smooth working?
    In other words, are there any errors and/or flaws in our strategy?
    Thanks,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

  • Convert Calendar to Java.sql.Date

    I seached for a solution for converting a Calendar-object to a java.sql.date for inserting it into a MySQL DB (DateTime). I know this question is a FAQ. The solution I found is the following code:
    java.sql.Date sqlDate =  new java.sql.Date(cal.getTime().getTime() );When i do a print of the sqlDate to the console I get: sqlDate: 2005-06-27
    But when I look into de DB I get the following date: 27/05/1905
    I know that in Java the months are starting from 0-�11 and that the years counting is starting from 1900. But I assume that the solution is not to just add the correct month and year manually. because I get a correct console-output. If I do this I get a correct DB Date, but a wrong console-date.

    II dont know if you found an answer but I needed a similar solution so I wrote a test program.
    Let me know if this solves the problem for you.
    import java.util.*;
    import java.sql.*;
    public class dateTest{
    public static void main(String args[]){
    // Step by step
    // Calendar rightNow = Calendar.getInstance();
    // java.util.Date today = rightNow.getTime();
    // long theTime = today.getTime();
    // java.sql.Date sDate = new java.sql.Date(theTime);
    // In one line
    java.sql.Date sDate = new java.sql.Date(Calendar.getInstance().getTime().getTime());
    System.out.println("sDate is: "+sDate.toString());
    }

  • Any latest addition regarding java.sql.Date

    I have separate strings "10/21/2003" and "02:33:27".
    Just to convert String "10/21/2003" to sql date, do I really need to call up simple date format and parsing it?
    why? there is no time associated with this string. The time is on a separate string.
    I am using preparedstatement.

    Did I do unnecessary steps in getting to sql.Date ?
    String sDate = "10/16/2003";
    String sTime = "02:12:54:;
    String year = sDate.substring(6,9);
    String month = sDate.substring(0,1);
    String day = sDate.subst....
    String sDateNew = year + "-" + month + "-" + day;
    // the string becomes 2003-10-16.
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
    java.util.Date uDate = sdf.parse(sDateNew);
    long time = uDate.getTime();
    java.sql.Date sqlDate = new java.sql.Date(time);
    pstmt.setDate(i, sqlDate);
    It works, but did I put in extra steps ?
    I tried using the same trick for sTime, but that did not work out.

  • Date/Time Field in Access 2000 - INSERT INTO ... syntax error

    I am using Labview 6.1 Professional with the Database Connectivity Toolkit. When I execute this SQL Command "INSERT INTO PRODUCTION (Part, Passed, Date) VALUES ('Part#1', 2, '10/10/2003 10:10:10 AM')" I get a Run-Time Syntax Error. If I remove the Date Label and Date Value it works. What is the proper Format of the Date/Time Type Field in ACCESS 2000 for Labview 6.1 SQL? I have seen and tried all of the solutions already posted like MSG 1ZNAJHJ6.

    Well, if it's any consolation handling dates is a pain regardless of which database you use. In any case, I created a table with the following definition:
    CREATE TABLE testing
    (item1 INTEGER,
    item2 DATE)
    I them did the following insert:
    INSERT INTO testing
    VALUES (1, '18/11/1953 04:20:00');
    And everything worked fine. Note that in the date (my Bday, BTW) the format is DD/MM/YYYY followed by the time.
    What exactly is the error you're getting? Can you post the exact text of the error message. Also, I ran my test using the examples that come with LabSQL--not the toolkit.
    Mike...
    Oops, just noticed something. You have a column name that is probibly a reserved word "Date". Try your insert as:
    INSERT INTO PRODUCTION
    VALUES
    ('Part#1', 2, '10/10/2003 10:10:10 AM')
    If there is only those three columns and they the order the data appears is the same as the column order, you don't need the column list. If this works (and it should--I just tried it) I would only view it as a temporary patch. The column name should be changed.
    This is also a good reason to not use the Access GUI to create tables. If you tried creating a table like that in SQL you would have gotten an error message. Learning to build tables in SQL code isn't hard and it adds an extra layer of error checking that the GUI apparently doesn't think is important.
    If you're interested let me know and I can send you the info on a really good book on SQL...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • SQL Insert Statement Data Type Mismatch Error

    I am doing a very simple web application that has a Microsoft Access database as the data source. I have been able to sucessfully create update and query statements using parameters but am having issues with an insert statement. I am using JSTL 1.1.2
    The following code creates the data type mismatch error.
    <sql:update
         sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
            <sql:param value='$(ID}'/>
         <sql:param value='${feature}'/>
            </sql:update>The table has NUMBER as the data type for both of these fields and the variables I am feeding into it are both numbers. If I hard code the first number into the sql statement then it works. I have tried swapping the variables around and as long as the first one is hard coded the parameter for the second one works no matter which is first or second.
    However I can get the following code to work, which of course leaves me vulnerable to sql injection attacks which is not really a good thing.
    <sql:update>
         insert into tblTtoF(TFToolID,TFFeatID) values('<c:out value="${ID}"/>','<c:out value="${feature}"/>')
            </sql:update>So I am just looking for any suggestions as to why my first piece of code doesn't work seeing as it is the simplest of SQL statements and the most standard syntax.
    Thanks

    I changed it to the following
         <c:set var="featurenew" value="${0 + feature}"/>
         <c:set var="IDnew" value="${0 + param.toolID}"/>
              <sql:update
              sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
              <sql:param value='$(IDnew}'/>
              <sql:param value='${featurenew}'/>
              </sql:update>And got the following error in the localhost.log
    31/07/2006 09:31:41 org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.sql.SQLException: SQL Exception : [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1437)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1072)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1063)
         at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.setParameters(UpdateTagSupport.java:254)
         at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doEndTag(UpdateTagSupport.java:156)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_sql_update_1(dataUpdated_jsp.java:975)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_if_0(dataUpdated_jsp.java:879)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_forEach_0(dataUpdated_jsp.java:680)
         at org.apache.jsp.dataUpdated_jsp._jspService(dataUpdated_jsp.java:151)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
         at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
         at java.lang.Thread.run(Thread.java:595)
    I have also tried the following in the past with no luck
    <fmt:parseNumber value="${ID}" type="number" var="IDnew"/>
    AND......
    <sql:query
       sql="select TFToolID from tblTtoF where TFToolID = ?"
       var="toolresults">
       <sql:param value="${ID}"/>
    </sql:query>
    <c:forEach var="getID" items="${toolresults.rows}">
         <c:set var="theID" value="${getID.TFToolID}"/>
    </c:forEach>
    AND when that didn't work, added this....
    <fmt:parseNumber value="${theID}" var="IDnew"/>

  • How not to insert a Date/Time field on INSERT

    hi all, i have a MSAccess table which has a lot of fields one of which is a date/time field......
    when i run the SQL code to insert values into this table i want the date/time field to be left blank.....
    i have tried to insert a blank space using '' but it shows the error
    SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    does anyone know how i can overcome this problem.....?

    that worked thanks a lot,
    the values are inserted into the database now but i still get an error
    SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    but the values are inserted....a bit confused about that any reason why that would happen?

Maybe you are looking for

  • Right way for battery charging

    Hi everybody! I bought an iPad Air when he was released. Surfing on Internet, I've heard conflicting opinions about the right way to charge the iPad (or the iPhone) to increase its battery life. What I want to ask is this: iit is true that once a mon

  • Connecting Creative Zen Touch to Stereo (Bose Lifestyle Syst

    Hi Folks,?A bit of a naf question, I want to connect my Creative Zen Touch to a Bose Life Style System, To provide the best quality Audio connection can you advise what is the best cable for me to use. On a seperate note has anyone any comments on th

  • Acrobat just won't open...

    Adobe Acrobat 8.1 has encountered a problem and needs to close. We are sorry for the inconvenience. I keep getting that pop up error every time I try to open it.  I've uninstalled all Adobe related software and reinstalled...still won't open.

  • How to Expand ALV Grid Total Width

    I have to display 1476 characters in an ALV grid and then the users will use what they need when creating a layout. Problem is ALV stops after displaying 1375 (or so) characters) - any parm or action to do this (maybe in the catalog setup sent to the

  • Converting Flash to Video Including Interactive Content/Games

    Hi All, I've recently been tasked with converting creative Flash content to video so that it can be viewed on iPads. For standard looping ads this is fairly straightforward and even expanding rich media ads can be set up to auto expand with a little