February 22, 2010 at 7:23 am
Can some one please tell me from this SQL
select right(convert(varchar,(DATEADD(dd,-(DATEPART(dw, getdate())),getdate())) , 111 ),5)
Actually this SQL giving: 02/20
But i wanted to get 2/20
Thanks
February 22, 2010 at 10:44 am
What value are you trying to get?
Depending on the value of the DATEFIRST you'll get different results...
There might be a more efficient way to do it.
Regarding the leading zero: What will you display for October, 1st? 10/01, 10/1, or 0/1?
February 22, 2010 at 12:28 pm
How does this work for you:
select replace(str(month(getdate()))+'/'+str(day(getdate())),' ','')
_________________________________
seth delconte
http://sqlkeys.com
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply