Steps to reproduce:
- Detach a database.
- Rename the physical files.
- In Toad, choose option to attach database.
- Browse to the .mdf, and select it.
Notice: There is no option to specify the physical location of the .LDF.
Click the SQL Script tab.
Notice: The filename of the .LDF is the old, not renamed filename – it is that way because it got pulled from within the .mdf – which is expected.
The bug is that unlike in SSMS, there is no way to fix the incorrect filename for the LDF.
The work around is to copy the script out to an editor and edit it manually.
- Best: Check the filename: If the filename of the .LDF doesn’t exist, try the SAME name as the .MDF already selected but with a .LDF extension, then try the same filename as the .MDF with _1 prior to the .LDF extension – this may not always work, but if it does work you’ve now saved us the work of having to edit the files manually.
- Do like SSMS does and show each LDF/NDF listed as their own rows with option to update the filename/path. (This could be in addition to the above).
- Allow edit of the script on the script tab so that it can be edited prior to clicking OK.