zoukankan      html  css  js  c++  java
  • 关于SQL系统对象

    1.获取所有用户信息:

       SELECT * FROM Sysusers

    2.获取所有数据库信息:

      select  *from  master..sysdatabases

    3.获取当前数据库下的所以表信息

      select   *   from   dbo.sysobjects

     where  xtype='U'

    xtype='U':表示所有用户表;
    xtype='S':表示所有系统表;

    4.获取指定表名下的所以字段信息

     select  * from dbo.syscolumns where  id=Object_Id('verbal')

     等价于:

    select  *from  syscolumns  where  id =(select  id from sysobjects where  xtype='U' and  name ='verbal')

    5.获取数据库所以类型:
     select  * from dbo.systypes

    6.获取字段的类型

    select a.name as [column],b.name as type from syscolumns a,systypes b where a.id=object_id('verbal') and a.xtype=b.xtype
    7.获取表结构:

    select column_name,data_type,character_maximum_length,* from information_schema.columns where table_name = 'verbal'

    8.获取数据库索引

    select * from  sysindexes where id=Object_Id('verbal')

    ID(如果 indid= 0 255)。否则为索引所属表的 ID
    9.
     

     

  • 相关阅读:
    2019年6月英语四六级试题及答案和视频教程
    经典解压缩软件 WinRAR 5.90 sc 官方去广告版
    会动的边框
    萌萌达机器人
    背景图片跟随鼠标动
    烟花代码
    常用正则表达式
    计算器
    顶部下啦菜单
    ps用画笔工具设计水墨圆环
  • 原文地址:https://www.cnblogs.com/linsu/p/2457473.html
Copyright © 2011-2022 走看看