Adding and Deleting Data and Transaction Log Files

USE [master]

GO

– Find DB’s Physical Filename ——————————————————————————————

 

SELECT

      LTRIM(RTRIM(a.name)) AS ‘Database Name’

      , CONVERT(SYSNAME, DATABASEPROPERTYEX(N+ a.name + , ‘Recovery’)) AS [Recovery Model]

      , LTRIM(RTRIM(b.name)) AS ‘Logical Filename’

      , b.filename AS ‘Physical Filename’

FROM master..sysdatabases a

INNER JOIN master..sysaltfiles b ON a.dbid = b.dbid

WHERE

      a.name = ‘pubs’   – database name

ORDER BY a.name

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.