Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    60

    Unanswered: Float to Datetime Conversion

    I need to convert values in a float data type field to that of datetime. The float data type field currently contains values such as 20060927,20060928, etc. Any suggestions?

    Thanks in advance,
    sajmera

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    convert(datetime,cast(cast(foo as integer) as char),112)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Aug 2003
    Posts
    60

    Thanks

    Thanks for the quick reply. I also tried the following and got the result.

    convert(datetime,convert(varchar(20),convert(int,c onvert(float,<field name>))))

    Thanks again!

  4. #4
    Join Date
    Apr 2007
    Posts
    183
    SELECT CAST(CONVERT(VARCHAR, Col1) AS DATETIME) AS NewValue
    FROM Table1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •