You may be required to restore a database backup to a location different from the location of the original backup. If you backed up with a password then this will need to be done programmatically.
The following example shows how to use a backup taken from a database called Database and restore it to a new location on a new server with the name Database2.
RESTORE DATABASE [NEW_DATABASE]
FROM DISK = N’\\NETWORK_STARAGE_LOCATION\database.BAK’
WITH password = ‘password’,
FILE = 1,
MOVE N’database’ TO N’C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\database2.mdf’,
MOVE N’database_log’ TO N’C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\database2.log,
NOUNLOAD, STATS = 10