Re: Storing only timepart in Sql server datetime
From: M O J O (mojo_at__no_spam_delete_this_newwebsolutions.dk)
Date: 09/02/04
- Next message: Joyjit Mukherjee: "Re: How to Implement IDBParameter Interface"
- Previous message: puneet dhall via .NET 247: "How to Implement IDBParameter Interface"
- In reply to: Cowboy (Gregory A. Beamer) - MVP: "RE: Storing only timepart in Sql server datetime"
- Next in thread: Kevin Yu [MSFT]: "Re: Storing only timepart in Sql server datetime"
- Reply: Kevin Yu [MSFT]: "Re: Storing only timepart in Sql server datetime"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 2 Sep 2004 07:40:14 +0200
Hi Grogory,
I'm doing this already today, but with Delphi. Now I'm using VB.Net and want
to do the same.
I'm using a DateTime field in MS SQL 2000, and by using Delphi's Frac method
(eg. Frac(SomeDateTimeVar)), it is stored in SQL server only showing the
time (when running a query).
I'm not looking for a Time field in SQL, I only want to store the Time in a
datetime.
M O J O
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@comcast.netNoSpamM> skrev
i en meddelelse news:F8099FD9-CA17-40BC-BDC3-C6F5062DF021@microsoft.com...
> Currently, there is no way to do it in this type of field. Even if you set
> everything to 0 plus time, you will have a date portion.
>
> In SQL 2005, you can create a UDT, but in SQL 2000, you are pretty much
> stuck with setting up a character data type for the time portion only.
> Eventually, you MAY have a time data type, but it is not going to be in
the
> initial 2005 release (for understandable reasons, BTW).
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
> "M O J O" wrote:
>
> > Hi,
> >
> > How do I store only the time part in a sql server datetime field?
> >
> > I've tried using ....
> >
> > Params.Add("@MyField", SqlDbType.DateTime, DateTime.Parse("00:05:00"))
> >
> > .... but it stores this value "01-09-2004 00:05:00".
> >
> > I want to store "00:05:00".
> >
> > Any idea???
> >
> > Thanks!!!
> >
> > M O J O
> >
> >
> >
- Next message: Joyjit Mukherjee: "Re: How to Implement IDBParameter Interface"
- Previous message: puneet dhall via .NET 247: "How to Implement IDBParameter Interface"
- In reply to: Cowboy (Gregory A. Beamer) - MVP: "RE: Storing only timepart in Sql server datetime"
- Next in thread: Kevin Yu [MSFT]: "Re: Storing only timepart in Sql server datetime"
- Reply: Kevin Yu [MSFT]: "Re: Storing only timepart in Sql server datetime"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|