fork download
  1. SELECT DatabaseName, TableName
  2.  
  3. ,CAST(SUM(CurrentPerm) /1024**3 as DECIMAL (6,0)) AS ActualSpaceGB
  4.  
  5. ,CAST(MAX(CurrentPerm)*(HASHAMP()+1) /1024**3 as DECIMAL (6,0)) as EffectiveSpaceGB
  6.  
  7. ,EffectiveSpaceGB-ActualSpaceGB AS WasteSpaceGB
  8.  
  9. ,CAST(100*(((MAX(CurrentPerm)*(HASHAMP()+1) /1024**3)-(SUM(CurrentPerm) /1024**3))/ (MAX(CurrentPerm)*(HASHAMP()+1) /1024**3)) as DECIMAL (6,0)) AS "WasteSpace%"
  10.  
  11. ,CAST((100 - (AVG(CurrentPerm)/MAX(CurrentPerm)*100)) as DECIMAL (6,0)) AS SkewFactor
  12.  
  13. FROM DBC.TableSize
  14.  
  15. WHERE DatabaseName='<Database Name>'
  16.  
  17. GROUP BY 1,2
  18.  
  19. ORDER BY 5 DESC
Success #stdin #stdout #stderr 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: near line 1: near "*": syntax error