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

  • 相关阅读:
    使用DataReader
    使用Dataset
    Command
    Ado.net对象
    集合数据源
    Label 表达式绑定
    输出二进制图像
    Application 可以存储全局变量
    字符串处理
    ?:叫条件运算符
  • 原文地址:https://www.cnblogs.com/ringwang/p/993588.html
Copyright © 2011-2022 走看看