Re: Date format
From: oj (nospam_ojngo_at_home.com)
Date: 02/28/04
- Next message: Trint Smith: "Need to UPDATE while conditions change..."
- Previous message: Marvin: "Re: Function error"
- In reply to: Olivia: "Re: Date format"
- Messages sorted by: [ date ] [ thread ]
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 > >> > > > > > >. > >
- Next message: Trint Smith: "Need to UPDATE while conditions change..."
- Previous message: Marvin: "Re: Function error"
- In reply to: Olivia: "Re: Date format"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|