zoukankan      html  css  js  c++  java
  • 有用的数据SQL脚本(做数据字典比较有用哦)

    select [name] from [sysdatabases] order by [name]
     

    查询一个数据库中的所有表

    select [id][name] from [sysobjects] where [type] = 'u' and status>0

    都知道
    [type] = 'u' 是用户表,[type] = 's'是系统表吧。


    根据上个语句的查询结果然后再

    查询一个表中的所有字段(我尝试不用
    [ID],而用[name]去查,结果报错了)

    select [name] from [syscolumns] where [id] = 1931153925

    查询表结构
    SELECT table_name,column_name,column_default,
        is_nullable,data_type,character_maximum_length     
    FROM INFORMATION_SCHEMA.COLUMNS 

    SELECT table_name as '表名',column_name as '列名',data_type as '类型',
        character_maximum_length 
    as '长度',column_default as '默认值',is_nullable as '是否为空'     
    FROM INFORMATION_SCHEMA.COLUMNS 
    where table_name in(select name from sysobjects where xtype='u' and status>0)
    order by table_name


    将孤立的用户名关联
    sp_change_users_login 
    'report'
    sp_change_users_login 
    'update_one','OAS','OAS'

    sp_change_users_login 
    'Auto_Fix''test'NULL'testpassword'

  • 相关阅读:
    vim中如何设置多行注释和删除注释
    ubuntu如何设置普通用户密码
    ubuntu中出现syntax error:Bad for loop variable
    学习进度条
    单元测试练习
    用户体验设计案例分析
    学生成绩录入系统设计与实现
    需求分析
    结对项目——词频统计2
    结对项目—— 词频统计
  • 原文地址:https://www.cnblogs.com/ringwang/p/1230916.html
Copyright © 2011-2022 走看看