DECLARE @Dbname VARCHAR(20)
DECLARE @Date DATETIME
DECLARE @test VARCHAR(30)
SET @Dbname = 'Test'
SET @Date = GETDATE()
SET @test = 'c:\test' + @Dbname
SELECT @test = @test + CONVERT(VARCHAR(10), @Date, 112) + '.bak'
BACKUP DATABASE @Dbname TO DISK = @test
Comments