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 2000 Forums
 Transact-SQL (2000)
 How to show day in a query?

Author  Topic 

daipayan
Posting Yak Master

181 Posts

Posted - 2010-04-17 : 06:23:16
Hello All,

I am having a column name newsdate where I am going to insert the present date through
getdate()
.
----------
newsdate
----------
03/04/2010
04/04/2010
05/04/2010
06/04/2010
07/04/2010
08/04/2010
09/04/2010
----------

Through the query I want to show the following column data as:
-------------------------
newsdate
-------------------------
Saturday, 03 April, 2010
Sunday, 04 April, 2010
Monday, 05 April, 2010
Tuesday, 06 April, 2010
Wednesday, 07 April, 2010
Thursday, 08 April, 2010
Friday, 09 April, 2010
-------------------------


Hope I can make you understand my query.

Daipayan

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-17 : 06:55:31
use datename(weekday, newsdate) to show the week day name


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

daipayan
Posting Yak Master

181 Posts

Posted - 2010-04-17 : 07:08:48
But through this, am only getting only the weekday.
What about the rest part i.e. 03 April, 2010??

quote:
Originally posted by khtan

use datename(weekday, newsdate) to show the week day name


KH
[spoiler]Time is always against us[/spoiler]





Daipayan
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-17 : 07:27:44
use convert(varchar(20), newsdate, 106)


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-17 : 07:50:32
refer to the BOOKS ONLINE http://msdn.microsoft.com/en-us/library/ms187928.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

daipayan
Posting Yak Master

181 Posts

Posted - 2010-04-18 : 05:39:36
Thank You all!

After understanding your helps, I did this:
datename(weekday, datetime)+' '+convert(varchar(20), datetime, 106)

and it is working fine...

Daipayan
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-19 : 06:00:48
Also if you use front end application, use format function there

Madhivanan

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

- Advertisement -