April 15, 2008 at 8:06 am
Hello,
Can somebody tell me how to calculate status that is given via db..sysfiles?
I see here that line
select *
from db..[sysfiles]
where (status & 64 = 0)
will give me only information about data file. But what if I would like to have information about log ?
April 16, 2008 at 9:16 am
select *-- data files (*.MDF)
from sysfiles
where (status & 0x40) = 0
select *-- tranlog files (*.LDF)
from sysfiles
where (status & 0x40) <> 0
as per BOL
http://msdn2.microsoft.com/en-us/library/ms178009.aspx
but also notes you should be using new system tables, eg
select *-- data files (*.MDF)
from sys.database_files
where [type]=0
select *-- tranlog files (*.LDF)
from sys.database_files
where [type]=1
HTH
Dick
April 17, 2008 at 5:25 am
Thank you!
April 17, 2008 at 5:48 am
If you're using SQL 2005, rather use the view sys.database_files. the statuses are given in text, no decoding necessary.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply