zoukankan      html  css  js  c++  java
  • 查询数据库所有表、字段、触发器等

    SQL SERVER

    查看所有表名:
    select name from sysobjects where type='U'

    查询表的所有字段名:
    Select name from syscolumns Where ID=OBJECT_ID('表名')

    select * from information_schema.tables
    select * from information_schema.views
    select * from information_schema.columns

    查询所有触发器:

    SELECT * FROM Sysobjects WHERE xtype = 'TR'

    查看当前库中所有的触发器和与之相对应的表:

    SELECT tb2.name AS tableName,tb1.name AS triggerName FROM Sysobjects tb1 JOIN Sysobjects tb2 ON tb1.parent_obj=tb2.id WHERE tb1.type='TR'


    ACCESS


    查看所有表名:
    select name from MSysObjects where type=1 and flags=0

    MSysObjects是系统对象,默认情况是隐藏的。通过工具、选项、视图、显示、系统对象可以使之显示出来。

    Oracle
    select cname from col where tname='ZW_YINGYEZ'

    select column_name from user_tab_columns where table_name='ZW_YINGYEZ'

    查询表字段数
    select count(column_name) from user_tab_columns where table_name='表名';

  • 相关阅读:
    php extends
    php 冒泡排序
    php base64_encode和base64_decode 编码/解码url
    php use
    php命名空间示范
    php 传一个url抓取此页面所有的链接
    pyspark
    【P1330】 封锁阳光大学
    [p1967] 货车运输
    分治的思想
  • 原文地址:https://www.cnblogs.com/ahdsxhs/p/6560250.html
Copyright © 2011-2022 走看看