tags:

views:

184

answers:

3

Hi

How can I change the logical database name when restoring a database with SMO?

/Viktor

A: 

Refer this SO question

HotTester
I can't see how that question is related, I need to change the logical name of the database, not the physical. Am I missing something here?
Viktor
+1  A: 

You can't rename the logical database files with a SQL RESTORE DATABASE: it's not offered. Only physical files can be changed using WITH MOVE

You rename logical files by using ALTER DATABASE in SQL, normally.

This appears to be be confirmed by the RelocateFile SMO class.

gbn
A: 
Rahul