May 10, 2012 at 10:58 am
I have a table where it lists all the "ServerName", "DBName", "DBSize", "Date"...but this table has a lot of duplicates information which I don't need, meaning I have serverNames repeating, DB name repeating, DB size from different date, etc....
My requirement is to get the unique list of all the servers, DBname, and the DBsize but only show the latest db size.
Anyone have any clue or t-sql script to get this information? Looking forward to your suggestions.
Regards,
TA
Regards,
SQLisAwe5oMe.
May 10, 2012 at 11:13 am
Can you post the table definition please?
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
May 10, 2012 at 11:15 am
GilaMonster (5/10/2012)
Can you post the table definition please?
Hi Gail,
Sorry, I don't have it.....I was trying to help someone. So, I don't have anymore information.
TA
Regards,
SQLisAwe5oMe.
May 10, 2012 at 11:25 am
Then the best I can do is guess and give you code that probably won't work as desired.
Select ServerName, DatabaseName, Size
FROM (
Select ServerName, DatabaseName, Size, RowNumber() Over (Partition by ServerName, DatabaseName order by SomeDateColumn DESC) AS RowNo
FROM SomeTable ) sub
Where RowNo = 1
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
May 10, 2012 at 11:44 am
May 10, 2012 at 1:24 pm
Jayanth_Kurup (5/10/2012)
if your doing this as part of managing multiple servers you can try using cms and query the sys tables directly
Thanks Gail....Will keep you posted.
TA
Regards,
SQLisAwe5oMe.
May 10, 2012 at 1:26 pm
SQLCrazyCertified (5/10/2012)
Jayanth_Kurup (5/10/2012)
if your doing this as part of managing multiple servers you can try using cms and query the sys tables directlyThanks Gail....Will keep you posted.
TA
Hi Jayanath,
This requirement is for monitoring purpose......Monitor all the server/DB growth for the whole environment.
TA
Regards,
SQLisAwe5oMe.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply