Update a date field in SQL database

I am using MS SQL 2000..and .Jdbc-odbc bridge
I have a field of type datetime...
I am trying to update that field value...using the following code
rs.updateDate(fieldname,java.sql.Date.valueOf(fval));
rs.updateRow();
where fVal is a string...
It gives me a SQl Exception saying invalid date value..
Can any throw any light on this...helping me to overcome my error...

This problem is solved...I am just inserting it as a string and the database takes care of everything...Now I have problems in inserting Integer value and a ntext value..
rs.updateInt(colname,1);
rs.updateRow();
This inserts a very big number like 1427560 etc into the database and second time it puts 0 to it...
For ntext it does not do anything
smita

Similar Messages

  • How to update transaction data automatically into MySQL database using PI

    Dear All,
    With reference to subject matter I want a sincere advice regarding how to update transaction data automatically into MySQL database using PI. Is there any link available where I can get step-by-step process.
    Ex: I have a MYSQL database in my organization. Whenever a delivery created in SAP some fields like DO Number, DO quantity, SO/STO number should get updated in MYSQL database automatically.
    This scenario is related to updation of transactional data into MYSQL DB and I want your suggestions pertaining to same issue.
    Thanks and Regards,
    Chandra Sekhar

    Hi .
    Develop a sceanrio between SAP to Database system,When the data updates in SAP Tables read the data and update it in DATA Base using JDBC adapter,but there will be some delay in updating data in MySQL.
    serach in sdn for IDOC-TOJDBC sceannario,many documents available for the same.
    Regards,
    Raja Sekhar

  • Urgent, Please help !!! Input Date field in Mysql database using JSP

    Hi All,
    Please help me ! I am trying to store a date field in MySql databaseusing JSP on Tomcat Server.I am gettting the following error.
    I am taking the String Input and then trying to convert it into date type
    inorder to store it into date field in a database.
    I am using the following code :
    <%
    try{
    String dt=request.getParameter("avldt");
    SimpleDateFormat adt= new SimpleDateFormat("dd-MM-yyyy");
    Date sqlToday = new java.sql.Date(adt.parse(dt).getTime());
    catch(ParseException e){
         e.printStackTrace();
    %>
    But I am getting the following error message :
    Class jsp.myjsp.SimpleDateFormat not found.
    Please help me !!!.It's very urgent.
    Thanks,
    Savdeep

    programming is more then copy pasting, it actually is usefull to think about what you are doing. First you declare that you date is format dd-MM-yyyy, then you want to parse a date in format dd/MM/yyyy and behold Java warns you it cannot parse the one into the second ! Cant you solve the rest of this puzzle yourself then ?

  • How do I update a date field through CMP

    I wonder how to update a date field through CMP.
    For example, I can't update an employee table with following statement.
    employee.setHire_date('2002-03-20');
    Thanks,

    Thats correct......
    Try using the following code....
    String strDate ="2002-03-20";
    String date_fmt = "yyyy-MM-dd";
    java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat(date_fmt);
    java.util.Date hireDate =null;
    hireDate =(Date) sdf.parse(strDate);
    employee.setHire_date(hireDate);
    Hope this helps
    Cheers
    --Venky                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Update a date field using execute immediate statement..

    I need to update a date field dynamically .
    Below is the code I have written for the same..
    EXECUTE IMMEDIATE
    'UPDATE Temp_Emp ' ||
    ' SET ' || V_Fieldname || ' = ' || D_Value ||
    'WHERE Emp_Id = ' || 8447;
    I am getting the following error..
    ORA-00904: "AUG": invalid identifier
    Pls anyone have any ideas..
    Thanks,
    Xyz

    put D_Value in single quotes like this
    EXECUTE IMMEDIATE
    'UPDATE Temp_Emp ' ||
    ' SET ' || V_Fieldname || ' = ''' || D_Value ||''' WHERE Emp_Id = ' || 8447;

  • How can i update the REMARK field in ADRT database table

    Hi all,
    How can i update the REMARK field in ADRT database table
    By using Function modules or BAPI’s
    Please reply me fast

    Hi,
    you can try this code:
        SELECT SINGLE * FROM KNA1 WHERE KUNNR = wa_kunnr.
        IF sy-subrc = 0.
          CLEAR adrct.
          SELECT SINGLE * FROM adrct WHERE addrnumber = kna1-adrnr.
          IF sy-subrc = 0.
            adrct-remark = wa_remark.
            MODIFY adrct.
          ENDIF.
        ENDIF
    best regards,
    Thangesh

  • JSP read and write data in MS-SQL database

    I am new to JSP. I need to write JSP page to read and write data in MS-SQL Database. I wonder if it is different from other database. I couldn't find useful pointers in the web. Please advise. Thanks!!

    Sure, SQL Server is different from Oracle is different from MySQL is different from...
    But all of them can be accessed using JDBC:
    http://java.sun.com/docs/books/tutorial/jdbc/
    Maybe you should learn about that for starters.
    You can use SQL tags from JSTL in your JSPs. I'd recommend JSTL highly. No scriptlet code that way. - MOD

  • Problem updating a date field via UnitOfWork - TopLink 9.0.3

    Hello,
    we want to change an exisiting application that employs TopLink 9.0.3, Build 423.
    The data is stored in an Oracle 9.2.0.6.
    The specific table has a composite primary key consisting of four fields.
    I can easily create a new Object (foo)
    uow.registerNewObject(foo)
    uow.commit()
    and see the results in the database.
    If I obtain an exising Object (bar) and change an integer
    bar = (Bar) Session.readObject(Bar.class, expr);
    cloneBar = (Bar) uow.registerObject(bar);
    cloneBar.setSomething(42);
    uow.commit()
    everything is fine.
    But if I dare to change a Date field
    cloneBar.setSomethingElse(cal.getTime());
    then
    uow.hasChanges()
    returns true
    but the update does not happen. It is neither logged nor is the data changed in the database.
    Is this a known bug?
    What have I done wrong?
    How can I avoid using hard-coded SQL to update my Bar object?
    Bye,
    Stephan

    Hello,
    it is very disturbing, but I finally found the reason for this problem.
    After decompiling the Project class file (we have no source code of this third-party library), I saw that the mapping for this specific field is set to "readOnly".
    I did not know that TopLink is able to have specific fields "readOnly" and others "readWrite", but it can handle this!
    So it seems that the behaviour is not a bug but a feature :-(
    We can change the mapping before creating the session, with the result that the field is updatable.
    Have a nice day.

  • Problem update a date field

    Hi,
    I have one table with a date field.
    For display all rows in a table component i'm using a dateTimeConverter object with format 'dd/MM/aaaa' and work fine.
    Bat when i update a data provider with follow code:
    public String update_action() {
    // TODO: Process the button click action. Return value is a navigation
    // case name where null will return to the same page.
    try {
    myDataProvider.commitChanges();
    myDataProvider.refresh();
    } catch(Exception e) {
    error("One error: " + e.getMessage());
    return null;
    return from brawser the follow message:
    Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 2 Data Exception -- No Applicable Cast Operator. from SQL type BINARY to SQL type DATE
    Anyone help me!
    Thanks.

    If you are getting the date from a calendar you have to convert it before storing it, for example, in the following code, the date got from the calendar is converted to a java.sql.Date
    java.sql.Date date1 = new java.sql.Date(calendar1.getSelectedDate().getTime());
    I hope this helps =)

  • Transfering data from External SQL database to BW

    Hi Experts,
         I am trying to extract data from an External SQL Database  in BW using      
         DB Connect.
        1. I have created a  DB Source System.
        2. Using this Source System I have generated a Datasoure.
           ( following all the naming conventions for Table Names and Field Names)
        Till this point everything is OK.
        Then I assign a Infosource and try to upload the data into PSA.
        The process is never complete and I am getting a message
       <i> <b>Request still running
        Diagnosis
        No errors could be found. The current process has probably not finished yet.
        System response
        The ALE inbox of the SAP BW is identical to the ALE outbox of the source
        system
        and/or
        the maximum wait time for this request has not yet run out
        and/or
        the batch job in the source system has not yet ended.
        Current status
        No Idocs arrived from the source system</b>.</i>
         please help me.
      thanks
      arshad

    please first tell me which wich user you connect and the exact name of your table/view: is it dbo.table?
    as I said, better create a user in your SQL, log with this user and create a view.
    in RSBDC select this view and generate datasource. Check if you see data.
    if yes, the load shouldn't fail.
    We came across the same issue: login with sa, accessing a dbo. object; seing the data in RSDBC but nothing loading...
    let me know
    Olivier.

  • Date fields in ILEARNING database

    Hi All,
    I am extracting data from the attempts table in ILEARNING directly using a user created for me to access the ILEARN schema objects i.e. Users, Attempt, Offering and Content object tables.
    One big problem I am faced with is getting the time portion from the dates fields in all these tables.
    For example the timestamp field when queried directly at the database will only provide date of attempt. However, when you run the same SQL in ilearning it will return the time portion in addition to the date within the same field.
    We are in the process of extracting our entire users and attempts data and creating a report to be ran over the ilearning client will fail as it can't handle the number of records we have particularly as regards to the attempt records.
    Any help, advice and guidance will be greatly appreciated.
    Thanks

    Hi,
    Have you tried formatting the datetime value in your query? Something like TO_CHAR(timestamp, 'DD-MON-YYYY HH24:MI:SS')
    Regards,
    Jason

  • Decrypting an ecrypted data field in Oracle Database

    I am trying to decrypt an ecrypted data field (which is in
    Oracle Database)in Java. Can somebody help me since I am totally
    new to this.
    Thanks

    Ganesh,
    I am writing a program in Java where I am trying to query an
    Oracle Database table for UserID and Password since this
    password is encrypted in Oracle Table so I want to decrypt it in
    my program and then further pass it for the user.
    Thanks
    Anu

  • Update existing date field

    select date1, arrtime, deptime,
    CASE WHEN arrdep = 'A' then
    to_date(to_char(date1, 'dd/mm/yyyy')||to_char(to_date(arrtime, 'hh24:mi'), 'hh24:mi'), 'dd/mm/yyyy hh24:mi')
    ELSE to_date(to_char(date1, 'dd/mm/yyyy')||to_char(to_date(deptime, 'hh24:mi'), 'hh24:mi'), 'dd/mm/yyyy hh24:mi')
    END as DepArr from table1
    output
    ====
    date1 arrtime deptime DepArr
    2005/10/25 0 0830 2005/10/25 08:30:00
    2005/10/27 2215 0 2005/10/27 22:15:00
    when i use the above select statement, the output displays fine, but when i tried to update the date1 field with DepArr, it fails with ORA-01861
    update table1 set date1 =
    CASE WHEN arrdep = 'A' then
    to_date(to_char(dt, 'dd/mm/yyyy')||to_char(to_date(arrtime, 'hh24:mi'), 'hh24:mi'), 'dd/mm/yyyy hh24:mi')
    ELSE to_date(to_char(dt, 'dd/mm/yyyy')||to_char(to_date(deptime, 'hh24:mi'), 'hh24:mi'), 'dd/mm/yyyy hh24:mi')
    END
    the date1 field's datatype is date
    thanks.

    As far as I can see, your select can be simplified to:
    select date1, arrtime, deptime,
    to_date(to_char(date1, 'ddmmyyyy')||decode(arrdep, 'A', arrtime, deptime), 'ddmmyyyyhh24mi') as DepArr
    from table1Make sure that date1 and arrtime/deptime is not null otherwise to_date will fail
    Message was edited by:
    Jens Petersen

  • How do I apply filters or limit the rows on my report using a Date field in SQL report builder 3.0?

    I have a status of completed and a date field in the dataset. The date field is either empty or contains a date. All 2015 dates are holding dates.
    So how can I limit the report to only pull completed status with an empty date or a holding date?
    I have not been able to set an OR option on a date field filter and if I add two filters on the date column one for empty one for > 12/31/2014 then it treats it as an "and" and pulls nothing from the list I have in sharepoint.
    any help will be appreciated.

    Hi MB,
    In Reporting Services, the relationship of  filters is “And”, and there is no option to change the relationship from “And” to “Or”. While we can use “or” operator within the expression to create one filter to integrated all filters to work around this
    issue.
    We can add a filter as follows in the dataset to limit the rows in your report:
    Expression: =Fields!date.Value is nothing or Fields!date.Value>"12/31/2014"    Type: Boolean
    Operator: =
    Value: true
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Data Search In SQL Database

    Hi, i want user to type a string in textbox, and i will search, if textbox.text exists in my SQL database table or not. Below is the code i'm using :---------------
     string txtname = (txtEmpName.Text).Trim();
     sQuery = "select * from tbUser where UserName='_username'";
     sQuery = sQuery.Replace("_username", txtname);
     SqlConnection objConnection = new SqlConnection(source);
     objDataAdapter = new SqlDataAdapter(sQuery,objConnection);
    // DataTable dtTable = new DataTable();
     if (objConnection.State  == ConnectionState.Closed)
     objConnection.Open();
     objDataSet = new DataSet();
     objDataAdapter.Fill(objDataSet);
    // objDataAdapter.Fill(dtTable);
    or i want to search if "txtname" exists in "tbUser" table.
    Thanks & Regards.
    Manish S. Anand

    This is a very poor coding, Unfortunately not fit anywhere :-(
    This code is a security risk (sql injection)!
    He should use SqlCommand class with parameters!
    but yet if i understand the problem he is facing, then the problem is in the SQL part of the code and not the Dot.net :-) therefor it is fit to this forum. Basically the code should work, but as i understand from him his problem is in the
    result set come back from the query filter. If so:
    * the problem is that he use:
    where UserName='_username'
    instead of:
    where UserName='%_username%'
    and he do ask about the search problem :-)
    [Personal Site] [Blog] [Facebook]

Maybe you are looking for

  • Upgrade power mac 6500/225 running 8.5 to 9.1(poss?

    Can anyone tell me if I can upgrade my power pc 6500/225 running 8.5 with upgraded memory to 96MB to run 9.1. If so, what are the steps to take.

  • IPhoto Shared iCloud Album Keeps Reappearing

    On my Mac, I keep trying to delete a Photo Stream- I Ctrl+Click ->Delete Photo Stream, and for 2 seconds it is gone, then it is rebuilt. I can't figure out how to permanently delete it. I still want to keep sharing/photo stream on, for other photos,

  • Dependency conflict in LV 2009

    Hello! I migrate from LV8.6 to LV2009. I open existing project, developed with LV8.6. When i open one VI inside of the project the dependency conflict is reported. This message was not detected in LV8.6. The program is running normal, but i don't hav

  • Stop DW from loading .js files constantly?

    I cannot find anything online that addresses this issue. DW (I've experienced this with all versions from mx to cs3) insists on loading every single .js file that a page links to when you open it for editing, regardless of whether you're in code or d

  • Cannot Sign In to OVI suit after belle update

    hi,m just having a problem with my new update,after the update there was many applications just vanished so i need to download all the softwares again,that's not the biggest deal... now i cant sign in to ovi store... when i press sign in button,befor