E PROCEDURE sp_ReturnFileName AS DECLARE @dtRetrieveFile datetime, @stPrefix char(25), @stSuffix char(4), @stTemp char(2), @stYear char(2), @stMonth char(2), @stDay char(2) SET @dtRetrieveFile = DateAdd(d, -1, GetDate()) -- may include UNC or local path in @stPrefix -- change declaration to the number -- of characters in @stPrefix SET @stPrefix = '\\server_name\share\ex' SET @stSuffix = '.log' -- Get two-digit year SET @stYear = Cast(Right(DatePart(yy,@dtRetrieveFile), 2) As char(2)) -- Get two-digit month SET @stTemp = Cast(Datepart(mm,@dtRetrieveFile) As char(2)) SELECT @stMonth = CASE Len(@stTemp) WHEN 1 THEN '0' + @stTemp页码:[1] [2] [3] [4] [5] [6] [7] [8] [9] 第4页、共9页 |