怎入第月,在存程中得到始,和束?
CREATE proc monthreporting @year int,@month int
as
select
--[一]=
--[月的最後]=
[解决办法]
CREATE proc monthreporting @year int,@month int
as
select
[一]= Rtrim(@year) + '- ' + Rtrim(@month) + '-01 ',
[月的最後]= Convert(Varchar(10), DateAdd(dd, -1, Rtrim(@year) + '- ' + Rtrim(@month + 1) + '-01 '), 120)
GO
EXEC monthreporting 2007, 5
GO
Drop proc monthreporting
--Result
/*
一月的最後
2007-5-012007-05-31
*/