To list the logical files in a sql server database in interactive OSQL sessions, try this:
Use mydb;
go
select * from sysfiles;
go
You will see a list of system files, including the names for log and data files. This is required information if you wish to run this command to shrink a log file that has grown too big for some reason:
dbcc shrinkfile([LOGICAL NAME OF LOG FILE IN DATABASE],X)
For example, to move a database to a new computer:
sp_helpfile; -- this lists the files
sp_detach_db 'testdb'; -- detach, you have to be using a different DB (you can not detach the database that you are on
sp_attach_db 'testdb', 'e:\data\testdb.mdf', 'e:\data\testdblog.ldf'; -- re-attach on new computer
Source: http://www.blackwasp.co.uk/MoveSQLDatabase.aspx
tags: sql, files, migrate, move, osql, raw, mssql, tsql, osql