Use smo to rename datafiles
问题 How can I use SMO to rename the physical .mdf .ndf .ldf files. This article was helpful but I need to use C# SMO Objects. Using the SMO Server Object I can retrieve the database, then Get Access to the DataFile objects. Per this link. These have a Rename, however after rename, nothing changes. 回答1: Well, I haven't tried this, but as per your first link, you can detach the database, rename the file on disk and then re-attach the database. So, give that a shot. The Server object in SMO has a