Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL DATE IN DATETIME - UPDATE

Author  Topic 

Tobisha
Starting Member

3 Posts

Posted - 2011-09-07 : 06:01:35
Hello, i need help in my sql.

Sorry my language but im from Portugal.

This is problem:

I have a mysql database.

I need to update table tbl_registos where i have an column where name is datainicio but datainicio is a datetime... Format = 'yyyy/mm/dd hh/mm/ss';

Example:

UPDATE tbl_registos
SET datafim = getdate()
WHERE datainicio = '2010/10/10';

The problem is datainicio is a datetime, contains a time, i need to convert...

Any solution?

Regards

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2011-09-07 : 06:08:25
are you using SQLserver.?

Karthik
http://karthik4identity.blogspot.com/
Go to Top of Page

Tobisha
Starting Member

3 Posts

Posted - 2011-09-07 : 06:14:45
Hum, I think yes...

Im using application in c# and use reference data.mysql..

Thanks
Go to Top of Page

Tobisha
Starting Member

3 Posts

Posted - 2011-09-07 : 10:55:30
Any Solutions/ideas?!?

I need help
Go to Top of Page

SergioM
Posting Yak Master

170 Posts

Posted - 2011-09-07 : 23:28:00
I went to http://www.google.com & I typed 'convert sql datetime to date only'. The first result seems to answer your question perfectly and in detail. http://blog.sqlauthority.com/2007/06/10/sql-server-retrieve-select-only-date-part-from-datetime-best-practice/
Go to Top of Page
   

- Advertisement -