元芳怎么了
CREATE FUNCTION GET_DATE(@BDATE DATETIME,@EDATE DATETIME)RETURNS @RE TABLE(ODATE DATETIME)ASBEGIN
DECLARE @DATE DATETIME
SET @DATE = DATEADD(DAY,1,@BDATE) WHILE DATEDIFF(DAY,@DATE,@EDATE)>0
BEGIN
INSERT INTO @RE
SELECT @DATE
SET @DATE = DATEADD(DAY,1,@DATE) END
RETURNENDSELECT * FROM dbo.GET_DATE('2012-1-1',' 2012-1-5')