Tags

, ,


This is probably going to be my last blog in this year..I am pretty happy with all the responses and suggestions that I am getting..the response has been overwhelming..I thank each and every one of you for reading and appreciating my blogs and giving all the suggestions through mails.

I take this opportunity to wish each and every one a VERY HAPPY and PROSPEROUS NEW YEAR-2011.

Many people requested me to write about this topic and I thought today is the right time to write about it is pretty simple one to cover..:-)

We can store the results of every DBCC commands to any permanent or temporary table and later on we can do our analysis. It is often useful to store the results to do some comparisons or for various analysis purposes.

Here I will store the results in a temporary table..

If(OBJECT_ID(‘tempdb..#logspace_utilization’) IS NOT NULL)
DROP TABLE #logspace_utilization

CREATE TABLE #logspace_utilization (
   Database_Name VARCHAR(50),
   Log_Size DECIMAL(20,5),
   Log_Space_Used DECIMAL(20,5),
   [Status] INT)

Now the main part..we are storing the result from the DBCC command into the temporary table we created above..

INSERT #logspace_utilization
EXEC(‘DBCC SQLPERF(LOGSPACE)’)
GO



Now if we will select the from the temporary table..we will get the resultset..Lets see..

SELECT * FROM #logspace_utilization

So in the same way, we can store the result of all the DBCC commands in the tables. Hope this helps.

Once again..wishing you a  VERY HAPPY & PROSPEROUS NEW YEAR..

Cheers,

Subhro Saha

Advertisements