Update in table with date field

Asked

Viewed 921 times

1

Hello! I need to update a table. I have a kind of chat in the bank, where it records the time the conversation was started, and should record the time it ended.

However, before I implemented the code that would record in the bank the final hour, it was null as I tested. So, I need to update the table to replace these fields.

The problem is that I have many service records with final NULL, and I need to make a update based on the day of that conversation. Below is an example of select table CHAT: select * from CHAT where HR_FIM is null

   ID     NOME                HR_INI                             HR_FIM 
   --     ------------        -----------------------            -----------------------
    4     Elisa               2015-04-10 17:39:50.875            NULL  
   13     Jorge               2015-04-10 18:08:33.958            NULL
   18     João                2015-04-10 18:34:44.794            NULL
   23     Sergio              2015-06-28 16:33:25.357            NULL

I can’t make a update because, as I would need to collect exact values for certain days, I could not simply give a where HR_FIM is null. I tried to make some conversions I found on the Internet, and it didn’t work either.

Grateful.

1 answer

-1


Boy, are there so many records? Why would I suggest you make one UPDATE CHAT SET HR_FIM = "data" WHERE ID="id" and HR_FIM IS NULL . That is, manually for each ID that has null HR_FIM.

But take a doubt, these values are only for testing?

Because another solution would be to update the current system time, where all HR_FIM are null. Because it would guarantee the filling of these null values, and breaking with dates after HR_INI.

  • Yes, they are for testing. But the client is extremely demanding, it seems that they want as mass information extremely close to reality. They wouldn’t accept such a high value, because it’s a real chat simulation. But I appreciate the suggestion, I think I’ll do just that. How would this update be with system time?

  • I got it. Thanks, @Ivan !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.