求救:在存储过程中,怎么根据输入的时间段 判断是几天啊?
比如 输入的参数是 2007-01-01 2007-02-05,怎么得出这一段时间的天数?
------解决方案--------------------select datediff(day, '2007-01-01 ', '2007-02-05 ')
------解决方案--------------------select datediff(dd, '2007-01-01 ', '2007-02-05 ')
------解决方案--------------------create proc get_day @dt_startdatetiem datetime,@dt_enddatetime datetime
as
select datediff(day,@dt_startdatetiem,@dt_enddatetime)
-----显示相差多少天-----
exec get_day '2007-01-01 ', '2007-02-05 '
------解决方案--------------------select datediff(dd, '2007-01-01 ', '2007-02-05 ')