zoukankan      html  css  js  c++  java
  • sql 获取数据库表名与某表的列名

    1:获取某表的列名

    select   列名=name   from   syscolumns   where   id=object_id(表名')

    2:获取数据库表中的表名

    select   表名=name   from   sysobjects   where   objectproperty(id, 'isusertable ')=1

    3:获取数据库表中的列名、字段类型、字段长度

     select o.name as tbname, c.name as columnname, (case t.name  when 'int' then '数字类型'
     when 'datetime' then '时间类型' when 'varchar' then '字符类型' end ) 字段类型,
      c.max_length from sys.tables as o join sys.columns
      as c on o.object_id=c.object_id join sys.types as t
      on c.system_type_id=t.system_type_id
       where  o.name='SmartForms'

  • 相关阅读:
    json数据读取后自动进行模板生成
    json数据排序
    fastjson json数据处理
    xml数据转Json
    jackson-dataformat-xml xml转json
    jar工具打包
    工具操作
    IBM MQ
    RabbitMq
    Excel4J
  • 原文地址:https://www.cnblogs.com/Jack_G/p/2721111.html
Copyright © 2011-2022 走看看