Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Rename MDF and Log file on a Database
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 01/19/2010 :  05:33:35  Show Profile  Reply with Quote

I'm a novice to SQL. I restored a database on to SQL 2005 which is working okay. But I've noticed the mdf and ldf files don't have the extension on them and are listed in the directory as unknown file.

What is the easist and quickest way to put the extension on to the file. I want to keep the filename same, just add the .mdf and ldf extensions.


Posting Yak Master

169 Posts

Posted - 01/19/2010 :  11:30:40  Show Profile  Visit RobertKaucher's Homepage  Reply with Quote
{ ADD FILE <filespec> [,...n] [TO FILEGROUP filegroup_name]
| ADD LOG FILE <filespec> [,...n]
| REMOVE FILE logical_file_name
| ADD FILEGROUP filegroup_name
| REMOVE FILEGROUP filegroup_name
| MODIFY FILE <filespec>
| MODIFY FILEGROUP filegroup_name filegroup_property

<filespec> ::=
(NAME = logical_file_name
[, FILENAME = 'os_file_name' ]
[, SIZE = size]
[, MAXSIZE = { max_size | UNLIMITED } ]
[, FILEGROWTH = growth_increment] )

Specifies the given file should be modified, including the FILENAME, SIZE, FILEGROWTH, and MAXSIZE options. Only one of these properties can be changed at a time. NAME must be specified in the <filespec> to identify the file to be modified. If SIZE is specified, the new size must be larger than the current size of the file. FILENAME can be specified only for files in the tempdb database, and the new name does not take effect until Microsoft® SQL Server™ is restarted.

Edit: I tried this and it did not work... Try detaching, renaming via explorer, the reattaching.

Edited by - RobertKaucher on 01/19/2010 11:47:10
Go to Top of Page


5072 Posts

Posted - 01/19/2010 :  11:59:12  Show Profile  Visit russell's Homepage  Reply with Quote
you modify logical name with alter database.

to modify physical name, detach, use OS level rename, attach.

can also use backup/restore with MOVE option
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000