返回:傍晚好,今天是2009年08月21日,星期五
create proc sp_dt
as
declare @ts nvarchar(10)
declare @tm int
set @tm=DATENAME(hh,getdate())
if(@tm < 6)
set @ts='凌晨好,'
else if (@tm < 9)
set @ts='早上好,'
else if (@tm < 12)
set @ts='上午好,'
else if (@tm < 14)
set @ts='中午好,'
else if (@tm < 17)
set @ts='下午好,'
else if (@tm < 19)
set @ts='傍晚好,'
else if (@tm < 22)
set @ts='晚上好,'
else
set @ts='夜里好,'
select @ts+'今天是'+DATENAME (yyyy,getdate())+'年'+DATENAME (mm,getdate())+'月'+
DATENAME (dd,getdate())+'日,'+DATENAME (weekday,getdate()) as dt
create proc sp_dt
as
declare @ts nvarchar(10)
declare @tm int
set @tm=DATENAME(hh,getdate())
if(@tm < 6)
set @ts='凌晨好,'
else if (@tm < 9)
set @ts='早上好,'
else if (@tm < 12)
set @ts='上午好,'
else if (@tm < 14)
set @ts='中午好,'
else if (@tm < 17)
set @ts='下午好,'
else if (@tm < 19)
set @ts='傍晚好,'
else if (@tm < 22)
set @ts='晚上好,'
else
set @ts='夜里好,'
select @ts+'今天是'+DATENAME (yyyy,getdate())+'年'+DATENAME (mm,getdate())+'月'+
DATENAME (dd,getdate())+'日,'+DATENAME (weekday,getdate()) as dt
本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/archive/2009/08/21/1551572.html,如需转载请自行联系原作者