USE [master]
RESTORE DATABASE [Bdc_Service_DB_6358c473529d48338f0dc0b9720d347e_2010] FROM DISK = N'C:\DBBackup\DBBackup\Bdc_Service_DB_6358c473529d48338f0dc0b9720d347e.BAK' WITH FILE = 1, MOVE N'Bdc_Service_DB_6358c473529d48338f0dc0b9720d347e' TO N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\Bdc_Service_DB_6358c473529d48338f0dc0b9720d347e_2010.mdf', MOVE N'Bdc_Service_DB_6358c473529d48338f0dc0b9720d347e_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\Bdc_Service_DB_6358c473529d48338f0dc0b9720d347e_2010_log.LDF', NOUNLOAD, STATS = 5
SELECT --name,
'RESTORE DATABASE [' + name + '] FROM DISK = N''G:\MSSQL11.SP2013\MSSQL\Backup\' + name + '.BAK'' WITH FILE = 1, NOUNLOAD, STATS = 5'
FROM master..sysdatabases
WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb');