常用SQL语句

常用SQL语句

  • Huawei
  • 发布:2023-11-02
  • 770次
  • 常用SQL语句
  • SELECT 表名,MB_DATA = CASE WHEN isnull(a.data,0) = 0 THEN 0 eLSE rOUND(A.DATA/1024,0) eND, GB_DATA = CASE WHEN isnull(a.data,0) = 0 THEN 0 eLSE rOUND(A.DATA/1024/1024,0) eND FROM (Select 表名,Convert(decimal(18,0),replace(索引占用的磁盘大小,'KB','')) as data From tb_SpaceInfoTable) a ORDER BY A.[data] DESC 


     SELECT 表名,MB_DATA = CASE WHEN isnull(a.data,0) = 0 THEN 0 eLSE rOUND(A.DATA/1024,0) eND, GB_DATA = CASE WHEN isnull(a.data,0) = 0 THEN 0 eLSE rOUND(A.DATA/1024/1024,0) eND FROM (Select 表名,Convert(decimal(18,0),replace(数据占用的磁盘大小,'KB','')) as data From tb_SpaceInfoTable) a ORDER BY A.[data] DESC