Online database documentation.
贫道2018年1月正式出道,可以说在IT界我就是个菜鸟。但我有着一颗不服输的心,我相信我会在这条路走上巅峰之道的。下面我来写我的第一份学习笔记:
介绍:大多数公司都有自己的数据文档,估计大多数都是用PowerDesigner、T4等写的吧,不知道有没有用线上的。在这我用SQL+MVC 写了个连接数据库的数据文档:
分为两个:
一、只读模式

主用sql语句:
查询数据库所有表:select name as tableName from sys.tables order by name
查询数据库表的描述:select a.name AS tname,isnull(g.[value],'-') AS destb from sys.tables a left join sys.extended_properties g on (a.object_id = g.major_id AND g.minor_id = 0) where a.name='表名'
查询表的字段详情说明等:
SELECT
col.name AS name ,
ISNULL(ep.[value], '') AS descript,
t.name AS datatype ,
CASE WHEN EXISTS ( SELECT 1
FROM dbo.sysindexes si
INNER JOIN dbo.sysindexkeys sik ON si.id = sik.id
AND si.indid = sik.indid
INNER JOIN dbo.syscolumns sc ON sc.id = sik.id
AND sc.colid = sik.colid
INNER JOIN dbo.sysobjects so ON so.name = si.name
AND so.xtype = 'PK'
WHERE sc.id = col.id
AND sc.colid = col.colid ) THEN '1'
ELSE ''
END AS iskey ,
CASE WHEN col.isnullable = 1 THEN '1'
ELSE ''
END AS isempty ,
ISNULL(comm.text, '') AS defult
FROM dbo.syscolumns col
LEFT JOIN dbo.systypes t ON col.xtype = t.xusertype
inner JOIN dbo.sysobjects obj ON col.id = obj.id
AND obj.xtype = 'U'
AND obj.status >= 0
LEFT JOIN dbo.syscomments comm ON col.cdefault = comm.id
LEFT JOIN sys.extended_properties ep ON col.id = ep.major_id
AND col.colid = ep.minor_id
AND ep.name = 'MS_Description'
LEFT JOIN sys.extended_properties epTwo ON obj.id = epTwo.major_id
AND epTwo.minor_id = 0
AND epTwo.name = 'MS_Description'
WHERE obj.name = '{0}'--表名
ORDER BY col.colorder ;
二:可更改表及字段的说明详情 (有权限者拥有)

主用的sql:
新增表说明:EXECUTE sp_addextendedproperty N'MS_Description', N'描述', N'user', N'dbo', N'table', N'表名', NULL, NULL
修改表说明:EXECUTE sp_updateextendedproperty N'MS_Description', N'描述', N'user', N'dbo', N'table', N'名', NULL, NULL
新增字段说明:EXECUTE sp_addextendedproperty N'MS_Description', N'描述', N'user', N'dbo', N'table', N'表名', N'column', N'字段名'
修改字段说明:sp_updateextendedproperty N'MS_Description', N'描述', N'user', N'dbo', N'table', N'表名', N'column', N'字段名'
代码十分简单,操作也是十分的简单,只需要配置一下连接即可,如下简单配置

Of course, if you have a better and easier way to share it with me.
This is my first note, thank you !
Online database documentation.的更多相关文章
- Oracle Database Documentation
Oracle数据库的发展简史 ORDBMS对象-关系数据库管理系统 Oracle Schema Objects Oracle Schema Objects——Tables——Overview of T ...
- 【原】Configuring Oracle Data Guard In Physical Standby Database
作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...
- P6 EPPM Manual Installation Guide (Oracle Database)
P6 EPPM Manual Installation Guide (Oracle Database) P6 EPPM Manual Installation Guide (Oracle Databa ...
- P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1
P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1 May ...
- GitHub: Oracle RAC Database on Docker 未测试 改天试试
https://github.com/oracle/docker-images/blob/master/OracleDatabase/RAC/OracleRealApplicationClusters ...
- Vertica 导出数据测试用例
需求:构建简单的测试用例,完成演示Vertica导出数据的功能. 测试用例:导出test业务用户t_jingyu表中的数据. 一.初始化测试环境 二.导出数据 2.1 vsql命令说明帮助 2.2 导 ...
- P6 EPPM Installation and Configuration Guide 16 R1 April 2016
P6 EPPM Installation and Configuration Guide 16 R1 April 2016 Contents About Installing and ...
- 在树莓派上安装leanote
作者:冥王星 "noright0@163.com" 前言 宿舍有个树莓派2B,连接到电视机,安装OSMC系统,USB接口连接移动硬盘一块,平时用来BT下载和看电影.美剧. OSMC ...
- Gazebo機器人仿真學習探索筆記(七)连接ROS
中文稍后补充,先上官方原版教程.ROS Kinetic 搭配 Gazebo 7 附件----官方教程 Tutorial: ROS integration overview As of Gazebo 1 ...
随机推荐
- 【mongodb系统学习之七】mongodb的关闭
七.mongodb的关闭: 1).直接根据进程id杀死mongodb进程,如图(注意,kill -9要慎用,这个是强制关闭进程,可能导致文件损坏,尽量不要用,可以直接kill不加参数): 2).如果不 ...
- java.lang.IllegalStateException: Failed to load ApplicationContext
1.错误描述 七月 13, 2014 6:34:41 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBean ...
- JDBCTemplate简化JDBC的操作(一)
接触过JAVA WEB开发的朋友肯定都知道Hibernate框架,虽然不否定它的强大之处,但个人对它一直无感,总感觉不够灵活,太过臃肿了. 今天来说下Spring中关于JDBC的一个辅助类(JDBC ...
- 游戏中实现粒子碰撞,纯java
package com.totoo.TouhouMassLight;import android.content.Context;import android.graphics.Bitmap;impo ...
- java操作impala
public class App { static String JDBC_DRIVER = "com.cloudera.impala.jdbc4.Driver"; static ...
- SpringMVC常用注解整理
一.组件型注解: @Component 在类定义之前添加@Component注解,他会被spring容器识别,并转为bean. @Repository 对Dao实现类进行注解 (特殊的@Compone ...
- Mysql遇到 is marked as crashed and should be repaired 问题解决方法
遇到 找到mysql的安装目录的bin/myisamchk工具,在命令行中输入: myisamchk -c -r /var/lib/mysql/ambari/alert_current.MYI 问题解 ...
- TypeScript入门知识五(面向对象特性二)
1.泛型(generic) 参数化的类型,一般用来限制集合的内容 class Person { constructor(private name: string) { } work() { }}var ...
- struts_自定义日期类型转换器
1.问题:struts默认的日期类型是 xxxx-mm-dd,不能接收xxxx/mm//dd类型的日期 2.解决方案(继承DefaultTypeConverter,覆盖convertValue(Obj ...
- Linux shell 脚本(一)
一.初识脚本 shell:一类介于系统内核与用户之间的解释程序.脚本:一类使用特定语言,按预设顺序执行的文件批处理.宏.解释型程序创建shell脚本:理清任务过程--整理执行语句--完善文件结构1.任 ...