Hi all.
I have a .sql file which backs up my sql express 2005 database and the code is
This works great but I would like to know how to include a date stamp in the filename so when it runs instead of the file being created as 'MyDatabase.bak' it would be 'MyDatabase_Tue05Feb_2200.bak' (Obviously if it was ran on 5th Feb at 22:00pm)
Can anyone advise pls.
Thanks
John
.NET 2.0, Visual Studio 2005, SQL Server 2005 Express
I have a .sql file which backs up my sql express 2005 database and the code is
Code:
BACKUP DATABASE [DatabaseName] TO DISK = N'D:\SharedFiles\My System\Database\Backup\MyDatabase.bak' WITH NOFORMAT, INIT, NAME = N'MyDatabase-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
This works great but I would like to know how to include a date stamp in the filename so when it runs instead of the file being created as 'MyDatabase.bak' it would be 'MyDatabase_Tue05Feb_2200.bak' (Obviously if it was ran on 5th Feb at 22:00pm)
Can anyone advise pls.
Thanks
John
.NET 2.0, Visual Studio 2005, SQL Server 2005 Express