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)
 Format date

Author  Topic 

ComputerMike
Starting Member

18 Posts

Posted - 2009-06-19 : 15:57:27
I have a number that represents a month and a number that represents a day. I need to return these formatted and part of a string.

Example

declare @Day int
declare @Month int

set @Day = 5
set @Month = 2

select 'Check ' + ????? + ' every year'

result should be....."Check 02/05 every year"

Should be simle but haveing really hard time...

Thanks,

Mike

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-06-19 : 17:49:52
You need to convert the ints to strings

select 'Check ' + right('0' + convert(varchar(2),@month),2)+'/'
+ right('0' + convert(varchar(2),@day),2)

+ ' every year'

Jim
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-20 : 02:06:07
shouldn't this be done in your presentation layer? can i ask need of building this string from sql itself? whats your front end app?
Go to Top of Page
   

- Advertisement -