First published on MSDN on Dec 12, 2017
when your test environment need a fresh copy of the data from production or any other scenario when fresh data is needed on another database you might find yourself seeking a quick and easy solution.
Solution Using TSQL:
when you connect to any of the databases on the server you can copy the database to another database on the same server.
[code language="sql"]CREATE DATABASE [ProdDB_TSQLFresh] AS COPY OF ProdDB;
DROP DATABASE ProdDB_TSQLCopy;
ALTER DATABASE ProdDB_TSQLFresh MODIFY NAME = ProdDB_TSQLCopy; [/code]