Updation of data with dublicate entry

  • I want to update the date coloumn in my database through jsp coding. In my table , there is no primary , so i can't use the where

    clause. I tried much but all are in vain.

    What i want is , i want to retrieve the date coloumn from my table and process the date conversion according to the SQL Date Format and finally put into the same table. So, i can't use where clause because there is no primary thing in my table.

    I'm bit confused, could any1 tell me the solution for this.

    In advance thanks....

  • If Date already stored in the database table then why are you modifying and restoring it again. If you need the format somewhere to show the date then you need the format rather then storing it again in the database.

    Surely you need to consider your design, if you have'nt the primary key or unique key then it will not a problem now but also create in future and the performance issue as well.

    Re-Think your design.

     

    cheers

  • Sometimes you inherit poorly designed systems and have to live with them until you can convince others of your pain in maintaining the data. In any case, if there are no primary or unique keys in the data then the best you could hope for is matching every field of the record in your where clause on the update statement to update that single field.

    UPDATE schema.tablename SET date = formatteddate WHERE field1 = field1, field2 = field2, date = date, etc.

    If you can select a single row in your code, then you should be able to update that single row. Otherwise you'll have to live with updating multiple rows which is extremely bad. You could always have some one add an identity column to the table for a primary key and that would solve your problems and should not impact storage or performance in a negative manner.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply