Re: Date format

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: oj (nospam_ojngo_at_home.com)
Date: 02/28/04


Date: Fri, 27 Feb 2004 22:18:39 -0800

Look like your imported data is not properly formatted. As far as style 100, it
should be implicitly converted to datetime.

Here is a quick demo.

create table #tmp(d1 datetime,d2 datetime, d3 datetime)
go
insert #tmp
select dt,
convert(varchar,dt,100),
convert(varchar,dt,101)
from(select getdate())x(dt)
go
select * from #tmp
go
drop table #tmp
go

-- 
-oj
http://www.rac4sql.net
"Olivia" <anonymous@discussions.microsoft.com> wrote in message
news:35a601c3fd60$f2bce7e0$a301280a@phx.gbl...
> This will not work because the fiel I'm loading the data
> into is a datetime datatype.
>
> >-----Original Message-----
> >Style of 101 will only return the date portion.
> >
> >If you want the time portion also, you want to use
> different style like 100.
> >
> >e.g.
> >select dt,
> >convert(varchar,dt,100),
> >convert(varchar,dt,101)
> >from(select getdate())x(dt)
> >
> >http://msdn.microsoft.com/library/en-us/tsqlref/ts_ca-
> co_2f3o.asp
> >
> >-- 
> >-oj
> >http://www.rac4sql.net
> >
> >
> >"Olivia" <anonymous@discussions.microsoft.com> wrote in
> message
> >news:287201c3fc9c$e4b60e20$a501280a@phx.gbl...
> >> I use the "CONVERT(DATETIME, Col1, 101) AS Col1" to
> >> convert the source string data and that is how my
> dateype
> >> is showing in my sql server environment:
> >> 2002-11-19 00:00:00.000
> >>
> >> Question 1: How can I have this showing the actual time
> >> instead of only zeros?
> >>
> >> Question 2: How can I have showing only the data without
> >> the time. Is there a default in my SQLServer?
> >>
> >> Thanks in advance for your help. Olivia
> >>
> >
> >
> >.
> >


Relevant Pages

  • Re: Simple Select Question
    ... select 1 pshipid,100 period,cast('20091130' as datetime) date ... union all ... FROM #tmp AS t INNER JOIN ... group by pshipid ...
    (microsoft.public.sqlserver.programming)
  • Re: Loss of Precision in DateTime
    ... How are you verifying it? ... DateTime - it can't physically be stored without the Time although it may ... If it's showing that way client side, ... > // Snip set db access obj ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Advice on the style to use in imports
    ... importing modules. ... I'm showing what I used in my current project, ... from pprint import pprint # Because pprint.pprint is just redundant ... from datetime import datetime # This might be a bad idea... ...
    (comp.lang.python)
  • Re: Use of Interval Datatype
    ... error in the wrong place (the interval column when it was the datetime ... '11:19:03' to DATETIME HOUR TO MINUTE ... showing 5 digits for the years). ...
    (comp.databases.informix)
  • Re: Use of Interval Datatype
    ... error in the wrong place (the interval column when it was the datetime ... '11:19:03' to DATETIME HOUR TO MINUTE ... showing 5 digits for the years). ...
    (comp.databases.informix)