MoonbasaDesign

SELECT  a.nonono 归纳 ,
        a.tablename 表名 ,
        a.name 列名 ,
        a.Typename 类型 ,
        a.max_length 最大长度 ,
        a.precision 精度 ,
        a.is_nullable 是否为空 ,
        ISNULL(sys.extended_properties.value, \'\') 注释
FROM    ( SELECT    \' \' nonono ,
                    sys.tables.name tablename ,
                    sys.columns.name ,
                    sys.types.name Typename ,
                    CONVERT(CHAR, sys.columns.max_length) max_length ,
                    CONVERT(CHAR, sys.columns.precision) precision ,
                    CONVERT(CHAR, sys.columns.is_nullable) is_nullable ,
                    sys.columns.column_id ,
                    sys.tables.object_id
          FROM      sys.tables ,
                    sys.columns ,
                    sys.types
          WHERE     sys.tables.object_id = sys.columns.object_id
                    AND sys.types.system_type_id = sys.columns.system_type_id
                    AND sys.types.user_type_id = sys.columns.user_type_id
          UNION
          SELECT    sys.tables.name nonono ,
                    sys.tables.name tablename ,
                    \'\' name ,
                    \'\' Typename ,
                    \'\' max_length ,
                    \'\' precision ,
                    \'\' is_nullable ,
                    0 column_id ,
                    sys.tables.object_id
          FROM      sys.tables
        ) a
        LEFT JOIN sys.extended_properties ON a.object_id = sys.extended_properties.major_id
                                             AND a.column_id = sys.extended_properties.minor_id
GROUP BY a.nonono ,
        a.tablename ,
        a.name ,
        a.Typename ,
        a.precision ,
        a.is_nullable ,
        a.max_length ,
        a.column_id ,
        a.object_id ,
        sys.extended_properties.value
ORDER BY a.tablename ,
        a.column_id ;

分类:

技术点:

相关文章:

  • 2021-09-07
  • 2022-02-15
  • 2022-12-23
  • 2021-11-18
  • 2021-05-10
  • 2022-01-31
猜你喜欢
  • 2021-10-06
  • 2021-12-06
  • 2021-12-06
相关资源
相似解决方案