title: How to get the logical name of the transaction log in SQL Server 2005
body: <p>I am trying to write a T-SQL routine that shrink the transaction log file using <strong>DBCC SHRINKFILE</strong> based on the logical name of the database.  The <strong><code>DB_NAME()</code></strong> function gives you the logical name of the database.  Is there an equivalent one for the transaction log?  If not, is there some other way to get this information?  The default name for the transaction logs is <code>&lt;&lt;Database Name&gt;&gt;_log</code>, but I would rather not rely on this.</p>