Re: SmallDatetime Conversion?



On Mon, 24 Sep 2007 08:28:06 -0700, Ryan Mcbee wrote:

I do I convert a field that is "smalldatetime" to "datetime"?

I am doing a select statement from a table and need my output to be
"datetime".

Hi Raj,

You can simply use

CAST (ColumnName AS datetime)

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
.



Relevant Pages

  • Re: between dates with no time consideration
    ... Columnist, SQL Server Professional ... just the range doesnt declare @start as datetime ... "Tom Moreau" wrote in message ... > "Tom Moreau" wrote in message ...
    (microsoft.public.sqlserver.programming)
  • Re: DateTime, variants and double
    ... SQL Server stores them as paired integers - see BOL ... The table has a field of type DateTime which for various reasons I ... SELECT CAST AS FLOAT) ... This email account is my spam trap so I ...
    (microsoft.public.data.ado)
  • Re: Convert help needed desperately
    ... overflow error converting expression to data type datetime. ... Is my sql server hosed???? ... > the timestamp data type. ...
    (microsoft.public.sqlserver.programming)
  • Re: trouble porting a trivially simple function - with declared variables
    ... CREATE FUNCTION my_max_market_date RETURNS datetime ... DECLARE @mmmd AS datetime; ... SQL Server comes with an extensive Online documentation, ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Problem with using BETWEEN for date range...
    ... you try to use anything else than 00:00:00.000 for the time porttion. ... And, no, our customers do not settle at midnight. ... To quote celko, using datetime to hold a pure date is really a kludge;), ... In SQL Server because we don't have a DATE data type we need to store ...
    (comp.databases.ms-sqlserver)