Sql-server – Script to Restore/Create SQL Server 2000 Database from Another Database’s Backup

backupsql serversql-server-2000

I'm trying to create a database, NewClientDB, by restoring another database's, OldClientDB, backup, d:…oldclientdb.bak. I've always done this via SQL 2000 Enterprise Manager, but the GUI keeps hanging. I've already created the empty NewClientDB.

Anyone know how to restore the OldClientDB's backup to NewClientDB via script without affecting OldClientDB?

Best Answer

RESTORE DATABASE [NewClientDB] 
FROM  DISK = N'D:\OldClientDB.bak' 
WITH  FILE = 1,  
MOVE N'OldClientDB_Data' TO N'C:\Data\MSSQL.1\MSSQL\Data\AdventureWorksNew_Data.mdf',  
MOVE N'OldClientDB_Log' TO N'C:\Data\MSSQL.1\MSSQL\Data\AdventureWorksNew_Log.ldf',  
NOUNLOAD,  STATS = 10

Source: BACKUP and RESTORE in SQL Server