标签:back backup name code ack move har from with
--backup Use [DBName] Declare @FullFileName Varchar(200) Declare @FileFlag varchar(20) Set @FileFlag=‘20‘+convert(char(6),getdate(),12) Set @FullFileName=‘d:\BackUp\‘+@FileFlag+‘.BAK‘ BackUp DataBase [DBName] To Disk=@FullFileName with init --restore Declare @FullFileName Varchar(200) Declare @FileFlag varchar(20) Set @FileFlag=‘20‘+convert(char(6),getdate(),12) Set @FullFileName=‘d:\BackUp\‘+@FileFlag+‘.BAK‘ RESTORE DATABASE [DBName] FROM DISK = @FullFileName WITH MOVE ‘DBName‘ TO ‘d:\SQLData\DBName.mdf‘, MOVE ‘DBName_log‘ TO ‘d:\SQLData\DBName_log.ldf‘
标签:back backup name code ack move har from with
原文地址:http://www.cnblogs.com/blossomwei/p/6923001.html