You are here: Re: Trigger For DateTime « MsSQL Server « IT news, forums, messages
Re: Trigger For DateTime

Posted by MGFoster on 07/19/05 22:22

wackyphill@yahoo.com wrote:
> Can someone give me a simple example of how to force a datetime value
> to be stripped of the time portion when it is added/updated to a table.
> I intend to use it for date only.
>
> I figured a trigger was the way to do this but haven't gotten the
> syntax right. Can someone please show me how? I've never written a
> trigger before.

Saw this in a --CELKO-- post:

here is a proprietary but fast way to trim off the time:

CAST (FLOOR (CAST (my_date AS FLOAT)) AS DATETIME) = my_date

use CEILING() and you go to the next day.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация