Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
shapper
Constraint Violating Yak Guru
450 Posts |
Posted - 2010-10-04 : 21:07:13
|
| Hello,I am trying to change the name and filename of a database primary filegroup:ALTER DATABASE [$(DatabaseName)]MODIFY FILE( NAME = '$(DatabaseName)', NEWNAME = '$(DatabaseName)_Data', SIZE = 40MB, MAXSIZE = 2GB, FILEGROWTH = 20MB );ALTER DATABASE [$(DatabaseName)]MODIFY FILE( NAME = '$(DatabaseName)_Data', FILENAME = '$(DefaultDataPath)$(DatabaseName)_Data.mdf');The filegroup is renamed but the file in the data folder is not.I tried various options including spiting this in two steps but it does not work.How can I do this?Thanks,Miguel |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-04 : 23:30:05
|
| Hi,You are changing the logical name of the file. AFAIK You cannot directly change the physical file name using Alter Database command.One easiest way to change the physical file name (or even path)is to detach the database, change the file name (or even path) and reattach the database.There are other ways too.Regards,Bohra |
 |
|
|
|
|
|