How do I do this?
Just issuing:
ALTER DATABASE Old_Name MODIFY NAME = New_Name
moves the mdf and ldf files to a new, unwanted location (apparently the SQL Server default as it's under program files) with the new name.
Is this possible or do I have to issue the additional ALTER DATABASE MODIFY FILE statements for this?modify name does not move the file(s).
create database [test]
on(name=test,filename='c:\test.mdf')
log on(name=test_log,filename='c:\test.ldf')
go
alter database [test] modify name=newtest
go
select *
from [newtest]..sysfiles
go
drop database [newtest]
go
==result==
1 test c:\test.mdf
2 test_log c:\test.ldf|||
Hi,
ALTER DATABASE ... MODIFY FILE command modifies the names of data files of the related database.
Please check the following article for also a sample on changing logical file names of SQL databases http://www.kodyaz.com/articles/change-sql-server-database-file-names.aspx
Eralper
|||Guess you didn't read my full post. I'm aware of this command.|||did you try my demo script. do you get the expected result?|||
Yeah, turns out it's not that part of the script but rather the Copy Database wizard that is to blame.
(I've got a post in tools on it bu gtno replies yet.)
No comments:
Post a Comment