zoukankan      html  css  js  c++  java
  • 数据库知识点滴积累

      这些都是工作中遇到的问题,后来通过网上查找积累下来的。

    查找一个数据库有多少个表?
    select count(*) from sysobjects where xtype='U'

    查找一个数据库下所有表的表名
    select name from sysobjects where xtype='U'
    SELECT name FROM sysobjects WHERE xtype = 'U' Or xtype = 'S' 
    查找一个表的结构
    select * from information_schema.columns where table_name ='表名' 
    查找非系统数据库
    Select name FROM Master.. SysDatabases where dbid>4
     
    停止触发器
      alter  table 'table_Name' disable trigger all
    开始触发器
      alter  table 'table_Name' enable trigger all

    --允许将显式值插入表的标识列中 ON-允许  OFF-不允许
    set identity_insert OrderList ON--打开

    insert into OrderList(id,ordername,createdate)
    values(4520,'set',getdate())

    set identity_insert OrderList OFF--关闭

    SET IDENTITY_INSERT [ database.[ owner.] ] { table } { ON | OFF }
    允许将显式值插入表的标识列中

    select name from sysobjects where xtype='TR' --所有触发器
    select name from sysobjects where xtype='P' --所有存储过程
    select name from sysobjects where xtype='V' --所有视图
    select name from sysobjects where xtype='U' --所有表
    select name from sysobjects where xtype in (N'FN', N'IF', N'TF') --所有的函数

  • 相关阅读:
    Seafile V4.1 安装笔记
    mysql int(3)与int(11)的区别
    python命令行参数处理模块 optparse 使用参考
    Python标准库 urllib2 的使用
    Python默认模块 os和shutil 实用函数
    ApacheBench 使用教程
    ThinkPHP中PATHINFO模式优化
    Perl中的特殊内置变量详解
    Perl内置变量速查表
    eclipse jetty debug
  • 原文地址:https://www.cnblogs.com/annabook/p/2572872.html
Copyright © 2011-2022 走看看