SQL Server Metadata
http://www.devart.com/dotconnect/sqlserver/docs/MetaData.html
https://msdn.microsoft.com/en-us/library/ms254969.aspx SQL
Server Schema Collections
In this overload first parameter is name of a collection, and second parameter is the array of restrictions to be applied when querying information. These restrictions specify which subset of the collection will be returned. The restrictions can include, for example, the database name (in this case, only collection elements belonging to this database will be returned) or the mask for the name of collection elements (only the elements satisfying this mask will be returned). The quantity and description of restrictions allowed for each metadata collection are represented in the table here. Their number can also be obtained from the return of the GetSchema() method. If the second parameter is null/Nothing, it is ignored.
GetSchema Method
Reference
The following table provides detailed information on metadata
collections that can be retrieved using the GetSchema method, and restrictions
that can be applied for them. When calling the GetSchema method, you can pass
all or few arguments. In the latter case, some default values are assumed, if
they were not specified explicitly. The default value of database restriction is
, table restriction is base table (.NET2) or table (.NET1).
Some collections are not supported in older server versions. If you try ro get
metadata for unsupported collection you will get exception with message
"Collection not defined".
| Collection Name | Number of restrictions | Remarks |
|---|---|---|
| Arguments | 2 | Returns list of arguments for stored procedures and functions on the server. Restrict it by database name and procedure name. |
| Columns | 3 | Returns list of columns, their type and some extra information. Restricted by database name, GetSchema returns columns of table "user" if it can be found in the database. The second restriction is name of a table that GetSchema method should search in. At last, you can set column name pattern as described in "Tables" collection. |
| DatasourceInformation | 0 | Returns information about the data source. |
| DataTypes | 0 | Returns information about data types supported by the data source. |
| ForeignKeyColumns | 2 | Returns list of columns used by foreign keys in the database. Restrict it with database name and table name. |
| ForeignKeys | 3 | Returns list of columns that participate in foreign keys. The first restriction for this collection is name of a database. The second restriction is table name mask. The third restriction is the key pattern. |
| Functions | 2 | Returns list of stored functions on the server. Restrict it by database name and function name. |
| IndexColumns | 4 | Returns list of indexed columns in the database, their type and some extra information. Restrict it with database name, table name, index name pattern, and column name pattern. |
| Indexes | 3 | Returns list of indexes and their details. The first restriction is database name The second restriction is table name. The last restriction is the index name pattern. |
| MetaDataCollections | 0 | Returns this list. Same as using GetSchema() method without parameters. |
| PrimaryKeys | 2 | Returns list of columns that participate in primary keys. The first restriction for this collection is name of a database. The second restriction is table name. |
| Procedures | 2 | Returns list of stored procedures on the server. Restrict it by database name and procedure name. |
| ReservedWords | 0 | Lists all reserved words used in the server. |
| Restrictions | 0 | Returns list of possible restrictions and their default values for the metadata collections. |
| Tables | 2 | GetSchema("Tables") returns list of tables in the current database. The first restriction for this collection is name of a database. If specified, the method returns all tables within the database. The second restriction is table name mask. You can use wildcards '%' (any number of characters) and '_' (one character) to retrieve names of tables that match the mask. |
| UniqueKeys | 2 | Returns list of columns that participate in unique keys. The first restriction for this collection is name of a database. The second restriction is table name. |
| UserPrivileges | 1 | Lists all users and their privileges on the server. When restricted by username, returns information about specific user. |
| Users | 1 | Lists all users on the server. When restricted by username, returns information about specific user. |
| ViewColumns | 3 | Returns list of columns used by views in the database. Restrict it with database name, table name and column name. |
| Views | 2 | GetSchema("Views") returns list of views in the current database. The first restriction for this collection is name of a database. The second restriction is view name mask. |
CollectionName # Name
Columns 1
TABLE_CATALOG
Columns 2 TABLE_SCHEMA
Columns 3
TABLE_NAME
Columns 4 COLUMN_NAME
Indexes 1
TABLE_CATALOG
Indexes 2 TABLE_SCHEMA
Indexes 3
INDEX_NAME
Indexes 4 TYPE
Indexes 5
TABLE_NAME
Procedures 1 PROCEDURE_CATALOG
Procedures 2
PROCEDURE_SCHEMA
Procedures 3 PROCEDURE_NAME
Procedures 4
PROCEDURE_TYPE
Tables 1 TABLE_CATALOG
Tables 2
TABLE_SCHEMA
Tables 3 TABLE_NAME
Tables 4
TABLE_TYPE
Views 1 TABLE_CATALOG
Views 2
TABLE_SCHEMA
Views 3 TABLE_NAME
集合:
MetaDataCollections
DataSourceInformation
DataTypes
Restrictions
ReservedWords
Users
Databases
Tables
Columns
StructuredTypeMembers
Views
ViewColumns
ProcedureParameters
Procedures
ForeignKeys
IndexColumns
Indexes
UserDefinedTypes
数据类型:
| smallint | System.Int16 | 16 |
| int | System.Int32 | 8 |
| real | System.Single | 13 |
| float | System.Double | 6 |
| money | System.Decimal | 9 |
| smallmoney | System.Decimal | 17 |
| bit | System.Boolean | 2 |
| tinyint | System.SByte | 20 |
| bigint | System.Int64 | 0 |
| timestamp | System.Byte[] | 19 |
| binary | System.Byte[] | 1 |
| image | System.Byte[] | 7 |
| text | System.String | 18 |
| ntext | System.String | 11 |
| decimal | System.Decimal | 5 |
| numeric | System.Decimal | 5 |
| datetime | System.DateTime | 4 |
| smalldatetime | System.DateTime | 15 |
| sql_variant | System.Object | 23 |
| xml | System.String | 25 |
| varchar | System.String | 22 |
| char | System.String | 3 |
| nchar | System.String | 10 |
| nvarchar | System.String | 12 |
| varbinary | System.Byte[] | 21 |
| uniqueidentifier | System.Guid | 14 |
SQL Server Metadata的更多相关文章
- sql:SQL Server metadata queries
http://www.mssqltips.com/sqlservertip/3449/making-sql-server-metadata-queries-easier-with-these-new- ...
- MySQL and Sql Server:Getting metadata using sql script (SQL-92 standard)
MySQL: use sakila; -- show fields from table_name; -- show keys from table_name; SELECT `REFERENCED_ ...
- 使用Microsoft SQL Server Migration Assistant for Oracle迁移数据库
前言:使用Microsoft SQL Server Migration Assistant for Oracle迁移Oracle数据库到SqlServer数据库. 准备:Oracle11g.SqlSe ...
- Microsoft SQL Server Migration Assistant for MySQL(从MySQL迁移表数据到MSSQL2008R2)_3
环境: 英文版(Windows7 64 bit + MySQL8.0.18 64 bit + MSSQL2008R2 64 bit) Microso ...
- SQL Server元数据损坏(metadata corruption)修复
在升级一个SQL Server 2000的数据库时,遇到了一致性错误,其中有几个错误是元数据损坏(metadata corruption),特意研究了一下这个案例,因为以前也零零散散的遇到过一些一致性 ...
- SQL Server 常用内置函数(built-in)持续整理
本文用于收集在运维中经常使用的系统内置函数,持续整理中 一,常用Metadata函数 1,查看数据库的ID和Name db_id(‘DB Name’),db_name('DB ID') 2,查看对象的 ...
- SQL Server性能计数器部署(批量)
一.计数器部署项目介绍 SQL Server每个服务器,日常需要监控的计数器指标高达上百,若一个个手动添加非常麻烦.此项目通过命令行工具针对指定计数器集成部署,提高部署效率.此包括开发数据库互联(OD ...
- 在Azure虚拟机上安装SQL server
Azure虽然向用户提供SQL paas服务,但是大多数用户还是习惯在用虚拟机自己搭建SQL server,这样的好处是便于后期最大化的扩展,所以鉴于这些情况,所以觉得有必要写这篇博客. 首先,我们要 ...
- SQL Server通过File Header Page来进行Crash Recovery
SQL Server通过File Header Page来进行Crash Recovery 看了盖总的一篇文章 http://www.eygle.com/archives/2008/11/oracle ...
随机推荐
- sql注入实例详解(二)
前言 这篇文章就是一个最基本的SQl手工注入的过程了.基本上在sqlilabs上面的实验,如果知道了其中的全部知识点,都可以通过以下的步骤进行脱裤.下面的这个步骤也是其他的脱裤手段的基础.如果想要精通 ...
- Tsung安装指南
1. 所需要软件包unixODBC-2.2.14.tar.gzotp_src_R13B02-1.tar.gztsung-1.3.1.tar.gzTemplate-Toolkit-2.22.tar.gz ...
- vscode 本地调试nodejs
1.首先通过node-inspect插件可以debug nodejs ,先起nodejs服务,再启用node-inpector服务 安装调试器 npm install -g node-inspec ...
- bzoj4842: [Neerc2016]Delight for a Cat
bzoj4842 这是一道网络流的题(大家都看出来了吧) 首先我们简化一下题目,选出最关键的部分(就是知道什么和要求什么,还有条件) 我们在这里把睡觉设为0,至少有t0时间在睡觉,把打隔膜设为1,至少 ...
- 2017 最新的 cocoaPods 安装方法
经过努力终于发现了最新的 解决cocoaPods安装的办法: taobao Gems 源已停止维护,现由 ruby-china 提供镜像服务 第一步:安装rvm, 不管需不需要升级ruby,rvm可以 ...
- Java Web 热部署
热部署有多种方案,下面的方案是其中的一种. 暂时还没找到一种令人满意的方案. 1,配置WEB Server 去这里 (https://tomcat.apache.org/download-90.cgi ...
- 2016级算法第六次上机-C.AlvinZH的学霸养成记II
1032 AlvinZH的学霸养成记II 思路 中等题,贪心. 所有课程按照DDL的大小来排序. 维护一个当前时间curTime,初始为0. 遍历课程,curTime加上此课程持续时间d,如果这时cu ...
- mysql工具——perror(mysql错误代码,查看错误号释义)
mysql工具——perror(mysql查看错误代码,查看错误号释义) 关键词:mysql错误代码,mysql错误号,perror
- Hadoop Hive概念学习系列之hive三种方式区别和搭建、HiveServer2环境搭建、HWI环境搭建和beeline环境搭建(五)
说在前面的话 以下三种情况,最好是在3台集群里做,比如,master.slave1.slave2的master和slave1都安装了hive,将master作为服务端,将slave1作为服务端. 以 ...
- 一头扎进sql之多表操作
一.多表查询时NULL值处理 要求返回比"allen"工资低的所有员工 select a.ename,a.conn from emp a where a.conn < ...