September 29, 2011 at 1:02 am
Here i need to get the log used space in sql 2005 , so that i can perform log used percentage in my project.
Thanks
Kumar
September 29, 2011 at 2:29 am
I'm sure there are a couple of ways how you can do it, but to me the simplest one would be this:
DBCC SQLPERF ( LOGSPACE )
[font="Verdana"]Markus Bohse[/font]
September 29, 2011 at 2:45 am
Thanks,
September 29, 2011 at 10:43 am
You can do this as well:
SELECT
DF.name,
size,
FILEPROPERTY(DF.name, 'spaceused') AS pages_used
FROM
sys.database_files AS DF
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
September 29, 2011 at 10:46 am
My 2 bits - I like to use the method that Jack showed.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 29, 2011 at 1:16 pm
Jack Corbett (9/29/2011)
You can do this as well:
SELECT
DF.name,
size,
FILEPROPERTY(DF.name, 'spaceused') AS pages_used
FROM
sys.database_files AS DF
..but that wouldn't return percentage used..............
---------------------------------------------------------------------
September 29, 2011 at 1:45 pm
george sibbald (9/29/2011)
Jack Corbett (9/29/2011)
You can do this as well:
SELECT
DF.name,
size,
FILEPROPERTY(DF.name, 'spaceused') AS pages_used
FROM
sys.database_files AS DF
..but that wouldn't return percentage used..............
Okay you got me there, although he didn't specifically ask for percentage used. Here's a query that includes pct used:
SELECT
DF.name,
size,
FILEPROPERTY(DF.name, 'spaceused') AS pages_used,
FILEPROPERTY(DF.name, 'spaceused') * 1.0/size * 100 AS pct_used
FROM
sys.database_files AS DF
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
September 29, 2011 at 2:31 pm
wasn't meaning to have a go Jack, I just read it that the op was after a percentage.
---------------------------------------------------------------------
September 29, 2011 at 2:48 pm
george sibbald (9/29/2011)
wasn't meaning to have a go Jack, I just read it that the op was after a percentage.
I know you weren't George. But you did get me. I read the OP as asking for how to get the space used so he could calculate the percentage later.
Unfortunately tone doesn't come across on when you type. I was trying to have some fun as well.:-P I should have used the smiley on the first post.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
September 29, 2011 at 3:57 pm
thought you were probably ok with it but didn't want to take the chance, as you say hard to convey tone.
I don't know the emoticon for 'not trying to be a smart ar5e but...' otherwise I would have added that to my first post 🙂
I was also hoping for some extra freebie code!
and hey - 4000 points!
---------------------------------------------------------------------
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply