declare @StartDate datetime
set @StartDate='2014-05-01'
DATENAME(dd,@StartDate)
我想获取日期部分为01而不是1,该如何做
declare @StartDate datetime,@day varchar,@d varchar(2)
set @StartDate='2014-05-1'
select @day=DATENAME(dd,@StartDate)
if len(@day)=1
begin
select @d='0'+ @day
end
else
begin
select @d=@day
end
print @d