二个SQL自定义函数。求当天最小时间和最大时间
CREATE FUNCTION f_GetThisDayBeginTime
(
@datetime datetime
)
RETURNS datetime
AS
BEGIN
RETURN convert(datetime,CONVERT(varchar(10),@datetime,120))
END
CREATE FUNCTION [dbo].[f_GetThisDayEndTime]
(
@datetime datetime
)
RETURNS datetime
AS
BEGIN
SET @datetime=CONVERT(VARCHAR(10),@datetime,120)+' 23:59:59.999'
RETURN(@datetime)
END