Home All Groups Group Topic Archive Search About
Author
14 Sep 2006 4:41 PM
FARRUKH
i am trying to run the query tht only brings the date. In our database we
have a date record like that  (1999-05-18 00:00:00.000)

Is there any way I run query and only bring  date(1999-05-18) not time
(00:00:00.000)?

thanks

Farrukh

Author
14 Sep 2006 4:49 PM
Aaron Bertrand [SQL Server MVP]
Sure, but you can't separate date and time.  The only way to do what you're
asking is to convert it to a string.

Why can't the application / presentation tier / reporting tool format the
date appropriately?

SELECT column_name = CONVERT(CHAR(10), column_name, 120) FROM table;



Show quote
"FARRUKH" <farrscorpi***@hotmail.com> wrote in message
news:7EC69F1E-B9BB-405A-8A79-388A2E0B93C6@microsoft.com...
>i am trying to run the query tht only brings the date. In our database we
> have a date record like that  (1999-05-18 00:00:00.000)
>
> Is there any way I run query and only bring  date(1999-05-18) not time
> (00:00:00.000)?
>
> thanks
>
> Farrukh
>
>
Author
14 Sep 2006 4:57 PM
FARRUKH
I dont want to see the time cuz its all zero. I just joined this company so i
dont know

Show quote
"Aaron Bertrand [SQL Server MVP]" wrote:

> Sure, but you can't separate date and time.  The only way to do what you're
> asking is to convert it to a string.
>
> Why can't the application / presentation tier / reporting tool format the
> date appropriately?
>
> SELECT column_name = CONVERT(CHAR(10), column_name, 120) FROM table;
>
>
>
> "FARRUKH" <farrscorpi***@hotmail.com> wrote in message
> news:7EC69F1E-B9BB-405A-8A79-388A2E0B93C6@microsoft.com...
> >i am trying to run the query tht only brings the date. In our database we
> > have a date record like that  (1999-05-18 00:00:00.000)
> >
> > Is there any way I run query and only bring  date(1999-05-18) not time
> > (00:00:00.000)?
> >
> > thanks
> >
> > Farrukh
> >
> >
>
>
>
Author
14 Sep 2006 5:12 PM
Tibor Karaszi
This should bring you up to speed on how the datetime datatype work in SQL Server:

http://www.karaszi.com/SQLServer/info_datetime.asp

Show quote
"FARRUKH" <farrscorpi***@hotmail.com> wrote in message
news:F316BEF9-999D-4807-A69E-29EFE94B22EE@microsoft.com...
>I dont want to see the time cuz its all zero. I just joined this company so i
> dont know
>
> "Aaron Bertrand [SQL Server MVP]" wrote:
>
>> Sure, but you can't separate date and time.  The only way to do what you're
>> asking is to convert it to a string.
>>
>> Why can't the application / presentation tier / reporting tool format the
>> date appropriately?
>>
>> SELECT column_name = CONVERT(CHAR(10), column_name, 120) FROM table;
>>
>>
>>
>> "FARRUKH" <farrscorpi***@hotmail.com> wrote in message
>> news:7EC69F1E-B9BB-405A-8A79-388A2E0B93C6@microsoft.com...
>> >i am trying to run the query tht only brings the date. In our database we
>> > have a date record like that  (1999-05-18 00:00:00.000)
>> >
>> > Is there any way I run query and only bring  date(1999-05-18) not time
>> > (00:00:00.000)?
>> >
>> > thanks
>> >
>> > Farrukh
>> >
>> >
>>
>>
>>
Author
14 Sep 2006 4:52 PM
Arnie Rowland
Formatting data for presentation is best done in the client
application -it's MUCH easier in the client languages.

However, if you have to do so in SQL, then you could do something like the
following:

SELECT convert( varchar(10), getdate(), 120 )

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


Show quote
"FARRUKH" <farrscorpi***@hotmail.com> wrote in message
news:7EC69F1E-B9BB-405A-8A79-388A2E0B93C6@microsoft.com...
>i am trying to run the query tht only brings the date. In our database we
> have a date record like that  (1999-05-18 00:00:00.000)
>
> Is there any way I run query and only bring  date(1999-05-18) not time
> (00:00:00.000)?
>
> thanks
>
> Farrukh
>
>
Author
14 Sep 2006 5:15 PM
Jim Underwood
in addition to what others have said, I believe there is an ODBC setting
that will control the date format for you, but I am not sure off hand.

Show quote
"FARRUKH" <farrscorpi***@hotmail.com> wrote in message
news:7EC69F1E-B9BB-405A-8A79-388A2E0B93C6@microsoft.com...
> i am trying to run the query tht only brings the date. In our database we
> have a date record like that  (1999-05-18 00:00:00.000)
>
> Is there any way I run query and only bring  date(1999-05-18) not time
> (00:00:00.000)?
>
> thanks
>
> Farrukh
>
>

AddThis Social Bookmark Button