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
 General SQL Server Forums
 New to SQL Server Programming
 What is worng in this?

Author  Topic 

learntsql

524 Posts

Posted - 2010-01-05 : 05:51:16
Hi..
I want to display like <NameField>+' '+01 Jan
I tried as follows

SELECT 'Name'+' '+CONVERT(VARCHAR(100),DAY(GetDate()))+' '+DATEPART(Month,GetDate())

but am getting conversion problem?
And how to display MonthName if i get monthNumber.
help me.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-05 : 05:53:24
DATEPART's return type is int thats why problem. use DATENAME() instead which will give you varchar value
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-05 : 05:56:10
Thank you.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-06 : 03:18:18
welcome
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-06 : 03:31:18

SELECT 'Name'+' '+CONVERT(VARCHAR(6),GetDate(),106)

Madhivanan

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

- Advertisement -