DECLARE @BeginTime AS DATETIME
DECLARE @EndTime AS DATETIME
DECLARE @Hour AS INT
DECLARE @Min AS INT
SET @Min = DATEPART(Minute
IF @Min <
BEGIN
SET @BeginTime = CONVERT(VARCHAR(
SET @EndTime = CONVERT(VARCHAR(
SET @BeginTime = DATEADD(Hour
END
ELSE
BEGIN
SET @BeginTime = CONVERT(VARCHAR(
SET @EndTime = CONVERT(VARCHAR(
END
EXEC up_GenReport @BeginTime
From:http://tw.wingwit.com/Article/program/MySQL/201311/29548.html