I have a table that I converted from MS Access and one of the colums I use t
o
store time values into has been converted to datetime and the year 1899 was
added to all existing records. I want to just display the time portion and
have tried the following code in the function I use to display the data:
CAST(ESR_CLOSE_TIME AS smalldatetime)
When I try to run the function I get an error saying the conversion resulted
in an overflow error. Any Ideas. Thanksyes - cast as datetime instead
the lowest smalldatetime value possible is Jan 1, 1900, so 1899 is out
of range.
AkAlan wrote:
> I have a table that I converted from MS Access and one of the colums I use
to
> store time values into has been converted to datetime and the year 1899 wa
s
> added to all existing records. I want to just display the time portion and
> have tried the following code in the function I use to display the data:
> CAST(ESR_CLOSE_TIME AS smalldatetime)
> When I try to run the function I get an error saying the conversion result
ed
> in an overflow error. Any Ideas. Thanks|||SELECT CONVERT(char(8), ESR_CLOSE_TIME , 108) --24hr time with seconds
SELECT RIGHT(CONVERT(char(19), ESR_CLOSE_TIME , 0),7) --with AM/ PM
The datetime datatype includes the date (year, month, day) and time with an
accuracy of 3/1000 of a second.
--
"AkAlan" wrote:
> I have a table that I converted from MS Access and one of the colums I use
to
> store time values into has been converted to datetime and the year 1899 wa
s
> added to all existing records. I want to just display the time portion and
> have tried the following code in the function I use to display the data:
> CAST(ESR_CLOSE_TIME AS smalldatetime)
> When I try to run the function I get an error saying the conversion result
ed
> in an overflow error. Any Ideas. Thanks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment