Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 DATETIME DATA TYPE

Author  Topic 

smitha
Posting Yak Master

100 Posts

Posted - 2009-12-02 : 05:35:25
hi,
I am using sql database and viewing the files using view.
But the date column in the database is showing date and time both as I want only date.Of course the data type itself is datetime. Is there any solution I can view only date and no time.
Please help me

Sachin.Nand

2937 Posts

Posted - 2009-12-02 : 05:44:28
select CONVERT(varchar(30),getdate(),110)

PBUH
Go to Top of Page

kbhere
Yak Posting Veteran

58 Posts

Posted - 2009-12-02 : 05:51:35
SELECT LEFT(GETDATE(), 11)

You can also try this..

Balaji.K
Go to Top of Page

smitha
Posting Yak Master

100 Posts

Posted - 2009-12-02 : 06:07:30
thanks I got that
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-02 : 08:00:40
quote:
Originally posted by kbhere

SELECT LEFT(GETDATE(), 11)

You can also try this..

Balaji.K



Dont reply on this
It is based on the language settings of the server

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-02 : 08:01:35
quote:
Originally posted by smitha

hi,
I am using sql database and viewing the files using view.
But the date column in the database is showing date and time both as I want only date.Of course the data type itself is datetime. Is there any solution I can view only date and no time.
Please help me


Another method is

select dateadd(day,datediff(day,0,getdate()),0)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -