Error in SQL. Can not find it.

Posted by kmsboy on Stack Overflow See other posts from Stack Overflow or by kmsboy
Published on 2011-01-05T00:46:25Z Indexed on 2011/01/05 0:53 UTC
Read the original article Hit count: 129

Filed under:
|

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 

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about tsql