zoukankan      html  css  js  c++  java
  • SQL 查询表字段长度, 名称, 类型, 存储过程创建和修改时间

    获取存储过程的修改时间和创建时间查询建立时间

    --表 
    
    select * from sysobjects where id=object_id(N'表名') and xtype='U'  
    
    --表的结构   
    
    select * from syscolumns where id=object_id(N'表名')     
    
    --存储过程   
    
    select * from sysobjects where id=object_id(N'存储过程名') and xtype='P' 
    

    查询最后修改时间

    --存储过程 
    
    select name,modify_date from sys.all_objects where type='P' order by modify_date desc
    
    --触发器 
    
    select name,modify_date from sys.all_objects where type='TR' order by modify_date desc 
    
    --表 
    
    select * from sys.all_objects where type='u' order by modify_date desc
    

    SQL 查询某个表下面的所有字段, 类型, 长度

    select column_name as ColumnName,data_type as DataType,character_maximum_length as [Length],* from information_schema.columns 
    where table_name ='TableName'

     
    --把所有的表的权限都修改为 dbo的权限

    EXEC sp_MSforeachtable 'exec sp_changeobjectowner ''?'',''dbo'' '
    
  • 相关阅读:
    vector的几种初始化和遍历
    剑指offer39 平衡二叉树
    和为s的两个数字
    c++参数传递的三种方式
    剑指offer40
    剑指offer28 字符串的排列
    PASCAL VOC数据集分析
    fast rcnn的实例
    cocos2dx下的A星算法
    vncserverpassword改动
  • 原文地址:https://www.cnblogs.com/hesijian/p/8472359.html
Copyright © 2011-2022 走看看