SQL Server, How to automate a database restore
Hi Guys, Today a little but (i hope) useful post! We will see how to automate the restore process of a database . Only with T-SQL command and scheduling a Job. Enjoy! Automate a database restore First of all we must say that the T-SQL language has a command to perform a restore of a database. The command is simply: RESTORE DATABASE database FROM DISK = ' nomefile ' WITH REPLACE However, sometimes the backup is created by adding the date , for example, to the name. This makes it a more difficult to automate the procedure. In addition, sometimes the backup of each database is stored in a different subfolder . So, how to automate this process? Suppose having a production database (product_db) and a test database (test_db) We want to align the data into the test database with the data in the production database . What we need is the name of the last backup we have done in the produ...