Dear all,
I have a table in which I have a field of type datetime.
If I insert a time value through a SP, SQL adds automatically a default
date.(instead of '8:30 AM' it inserts '1/1/1900 8:30 AM')
and if I manually edit/insert a value from the result pane, the data is
'8:30 AM' as I want it.
My question is: How to save only the time in the table via SP?
Thanks in advance.
jouj.
> My question is: How to save only the time in the table via SP?
Impossible in the datetime datatype. EM is fooling you and will put in date 1899-12-31 (I think) and
for some curious reason not display that date. Do a SELECT from Query Analyzer and you will see. I
suggest you read this article to de-mystify the datetime datatypes in SQL Server:
http://www.karaszi.com/SQLServer/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"jouj" <jouj@.discussions.microsoft.com> wrote in message
news:E8F456B7-C962-4B6F-A321-43852876E0F3@.microsoft.com...
> Dear all,
> I have a table in which I have a field of type datetime.
> If I insert a time value through a SP, SQL adds automatically a default
> date.(instead of '8:30 AM' it inserts '1/1/1900 8:30 AM')
> and if I manually edit/insert a value from the result pane, the data is
> '8:30 AM' as I want it.
> My question is: How to save only the time in the table via SP?
> Thanks in advance.
> jouj.
>
|||Thank you Mr. Karaszi.
jouj
"Tibor Karaszi" wrote:
> Impossible in the datetime datatype. EM is fooling you and will put in date 1899-12-31 (I think) and
> for some curious reason not display that date. Do a SELECT from Query Analyzer and you will see. I
> suggest you read this article to de-mystify the datetime datatypes in SQL Server:
> http://www.karaszi.com/SQLServer/info_datetime.asp
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "jouj" <jouj@.discussions.microsoft.com> wrote in message
> news:E8F456B7-C962-4B6F-A321-43852876E0F3@.microsoft.com...
>
No comments:
Post a Comment