zoukankan      html  css  js  c++  java
  • SQL学习笔记之显示用户表和用户表的结构

       
    下面是用sql语句显示数据库中所有的用户表。

    select [id], [name] from [sysobjects] where [type] = 'u' and status>0

    查询所有用户表的结构,这个语句在编写数据字典时很有用哦。如果想只显示一个表的话就在条件后面直接写上表名就可以了。

    SELECT table_name as '表名',column_name as '列名',data_type as '类型',
     character_maximum_length as '长度',column_default as '默认值',is_nullable as '是否为空' 
    FROM INFORMATION_SCHEMA.COLUMNS
    where table_name in(select name from sysobjects where xtype='u' and status>0)
    order by table_name

  • 相关阅读:
    poj3255,poj2449
    poj2186
    poj3249
    poj3378
    poj3274
    poj1948
    hdu 2181暴搜
    hdu 3342
    hdu 1285
    hdu 1598
  • 原文地址:https://www.cnblogs.com/ringwang/p/993588.html
Copyright © 2011-2022 走看看