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') --所有的函数

  • 相关阅读:
    ubuntu下Nodic开发环境搭建
    usb_modeswitch移植
    STM32F4编程手册学习2_内存模型
    STM32F4 编程手册学习1_编程模型
    ARM架构中的程序执行与调用
    锲形文字 数字
    疑问
    lisp 题目
    面试官在面试时让我去破解一个软件,我成功了
    php CI ip限制
  • 原文地址:https://www.cnblogs.com/annabook/p/2572872.html
Copyright © 2011-2022 走看看