Error in SQL. Can not find it.
- by kmsboy
Error in SQL. Can not find it.
DECLARE @year VARCHAR (4),
@month VARCHAR (2),
@day VARCHAR (2),
@weekday VARCHAR (2),
@hour VARCHAR (2),
@archivePath VARCHAR (128),
@archiveName VARCHAR (128),
@archiveFullName VARCHAR (128)
SET @year = CAST(DATEPART(yyyy, GETDATE()) AS VARCHAR)
SET @month = CAST(DATEPART(mm, GETDATE()) AS VARCHAR)
SET @day = CAST(DATEPART(dd, GETDATE()) AS VARCHAR)
SET @weekday = CAST(DATEPART (dw, GETDATE()) AS VARCHAR)
SET @hour = CAST(DATEPART (hh, GETDATE()) AS VARCHAR)
SET @archivePath = 'd:\1c_new\backupdb\'
SET @archiveName = 'TransactionLog_' + @year + '_' + @month + '_' + @day + '_' + @hour + '.bak'
SET @archiveFullName = @archivePath + @archiveName
BACKUP LOG [xxx] TO DISK = @archiveFullName WITH INIT , NOUNLOAD , NAME = N'?????????? ??? ??????????', SKIP , STATS = 10, DESCRIPTION = N'?????????? ??? ??????????', NOFORMAT