sql - How to update datetime field to contain only the date or time part -


how can update field contains date/time information contain date part of data? following:

update [events]   set [event_date] = dateadd(dd, 0, datediff(dd, 0, [event_date])   event_num = '8592' 

i need equivalent set time component?

you can truncate timestamp date or time casting it:

cast(event_date date) cast(event_date time) 

this documented in interbase 6 embedded sql guide, section casting sql datatypes datetime datatypes on page 188. manual available firebird website.

this works in dialect 3. if still working dialect 1 database, need use intermediate cast varchar (with locale specific length of 10 or 11) in maxims answer strip off time portion. because date in dialect 1 timestamp (and not date).


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -