用表来管理SQLServer中的扩展属性(描写叙述)

数据字典是个好东东,对于开发、维护很重要。

但Sql Server中写描写叙述确实不方便,怎样化繁为简、批量地添加改动扩展属性呢?

添加2个表和5个存储过程、2个触发器、1个表值函数就好了。

把以下的SQL运行一遍生成相关的对象, 然后运行一下:

1. EXEC Proc_Util_Desc_GetColumnNameToDescTable , 生成表的描写叙述相应记录

2. EXEC Proc_Util_Desc_GetTableNameToDescTable, 生成列的描写叙述相应记录

3. 查看, 改动一下 dc_util_column_desc 中的某个表某个列的描写叙述,

4. 查看: select * from [dbo].[Fun_GetTableStru](‘表名‘)

爽吧?!

--1.1 建表(存放表的描写叙述):dbo.dc_util_table_desc
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[dc_util_table_desc]') AND type in (N'U'))
	DROP TABLE [dbo].[dc_util_table_desc]
GO
CREATE TABLE [dbo].[dc_util_table_desc](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[tableName] [varchar](100) NULL,
	[tableDesc] [nvarchar](200) NULL,
 CONSTRAINT [PK_dc_util_table_desc] PRIMARY KEY CLUSTERED
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

--1.2 建表(存放列的描写叙述):[dc_util_column_desc]
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[dc_util_column_desc]') AND type in (N'U'))
	DROP TABLE [dbo].[dc_util_column_desc]
GO
CREATE TABLE [dbo].[dc_util_column_desc](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[tableName] [varchar](100) NULL,
	[columnName] [varchar](100) NULL,
	[columnDesc] [nvarchar](200) NULL,
 CONSTRAINT [PK_dc_util_column_desc] PRIMARY KEY CLUSTERED
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
 CONSTRAINT [UQ_dc_util_column_desc_tableName_columnName] UNIQUE NONCLUSTERED
(
	[tableName] ASC,
	[columnName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

--2.1 存储过程
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Proc_Util_Desc_DeleteInvalidData]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[Proc_Util_Desc_DeleteInvalidData]
GO
-- =============================================
-- Author:		yenange
-- Create date: 2014-05-29
-- Description:	删除 dc_util_table_desc 表和
--              dc_util_column_desc 表中不对的数据
-- =============================================
CREATE PROCEDURE [dbo].[Proc_Util_Desc_DeleteInvalidData]
AS
BEGIN
	SET NOCOUNT ON;
	--删除 dc_util_table_desc 中的无效数据
	DELETE FROM dbo.dc_util_table_desc WHERE NOT EXISTS (
		SELECT 1 FROM sys.tables T WHERE dbo.dc_util_table_desc.tableName=T.name
    )
    --删除 dc_util_column_desc 中的无效数据
    DELETE
	FROM   dbo.dc_util_column_desc
	WHERE  NOT EXISTS (SELECT 1 FROM sys.tables t INNER JOIN sys.columns c ON  t.object_id = c.object_id
							WHERE  t.SCHEMA_ID IN (SELECT SCHEMA_ID FROM sys.schemas WHERE  NAME = 'dbo')
								AND dbo.dc_util_column_desc.tableName=t.name AND dbo.dc_util_column_desc.columnName=c.name
						)
END
GO

--2.2 存储过程
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Proc_Util_Desc_GetTableNameToDescTable]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[Proc_Util_Desc_GetTableNameToDescTable]
GO
-- =============================================
-- Author:
-- Create date: 2014-05-29
-- Description:	将以 @tablePrefix 为前缀的表名和表相应的扩展属性 insert 到 dc_util_table_desc 表中去.
--              @tablePrefix 假设为 '' 或者 null, 则为所有表(默觉得null)
--              @overrideDesc : 假设已有记录存在,是否覆盖原记录的扩展属性 (默觉得1)
-- =============================================
CREATE procedure [dbo].[Proc_Util_Desc_GetTableNameToDescTable]
	@tablePrefix VARCHAR(100) =null,
	@overrideDesc BIT =1
AS
BEGIN
	SET NOCOUNT ON
	--删除表中无效的数据
	exec Proc_Util_Desc_DeleteInvalidData

	DECLARE @t1 TABLE(rn int IDENTITY(1,1),tablename VARCHAR(100),tabledesc NVARCHAR(200))
	--插入以 @tablePrefix 为前缀的表到@t1
	INSERT INTO @t1
	(
		tablename,
		tabledesc
	)
	SELECT convert(VARCHAR(100),t.name),
		   convert (nvarchar(200),p.value)
	FROM   sys.tables                         AS t
		   LEFT JOIN sys.extended_properties  AS p
				ON  p.major_id = t.object_id
				AND p.minor_id = 0
				AND p.class = 1
				AND p.name = 'MS_Description'
	WHERE  t.SCHEMA_ID IN (SELECT SCHEMA_ID
						   FROM   sys.schemas
						   WHERE  NAME = 'dbo')
	 AND (ISNULL(@tablePrefix,'')='' or t.name LIKE [email protected]+'%' )

	DECLARE @i INT
	DECLARE @i_max INT
	DECLARE @t_name VARCHAR(100)
	DECLARE @t_desc NVARCHAR(200)
	SET @i=1
	SELECT @i_max=COUNT(1) FROM @t1
	WHILE @i<[email protected]_max
		BEGIN
			SELECT @t_name=tablename,@t_desc=tabledesc FROM @t1 WHERE [email protected]
			IF @overrideDesc=1
				begin
					IF EXISTS(SELECT 1 FROM dc_util_table_desc WHERE [email protected]_name)
						UPDATE dc_util_table_desc SET tableDesc = @t_desc WHERE [email protected]_name
					ELSE
						INSERT INTO dc_util_table_desc(tablename,tableDesc) VALUES (@t_name,@t_desc)
				END
			ELSE
				BEGIN
					IF NOT EXISTS(SELECT 1 FROM dc_util_table_desc WHERE [email protected]_name)
						INSERT INTO dc_util_table_desc(tablename,tableDesc) VALUES (@t_name,@t_desc)
				END
			set @[email protected]+1
		END
END
GO
--2.3 存储过程
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Proc_Util_Desc_GetColumnNameToDescTable]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[Proc_Util_Desc_GetColumnNameToDescTable]
GO
-- =============================================
-- Author:
-- Create date: 2014-05-29
-- Description:	将以 @tablePrefix 为前缀的表名相应的列和列相应的扩展属性 insert 到 dc_util_column_desc 表中去.
--              @tablePrefix 假设为 '' 或者 null, 则为所有表(默觉得null)
--              @overrideDesc : 假设已有记录存在,是否覆盖原记录的扩展属性 (默觉得1)
-- =============================================
CREATE procedure [dbo].[Proc_Util_Desc_GetColumnNameToDescTable]
@tablePrefix VARCHAR(100) =null,
@overrideDesc BIT =1
AS
BEGIN
	SET NOCOUNT ON
	--删除表中无效的数据
	exec Proc_Util_Desc_DeleteInvalidData

	DECLARE @t1 TABLE(rn int IDENTITY(1,1),tablename VARCHAR(100),COLUMNNAME VARCHAR(100),columndesc NVARCHAR(200))
	--插入以 @tablePrefix 为前缀的表到@t1
	INSERT INTO @t1
	(
		tablename,
		COLUMNNAME,
		columndesc
	)
	SELECT convert(varchar(100),t.name)          ,
		   convert(varchar(100),c.name)              ,
		   convert(nvarchar(200),p.value)
	FROM   sys.tables                         AS t
		   LEFT JOIN sys.columns c
				ON  t.object_id = c.object_id
		   LEFT JOIN sys.extended_properties  AS p
				ON  p.major_id = t.object_id
				AND p.minor_id = c.column_id
				AND p.class = 1
				AND p.name = 'MS_Description'
	WHERE  t.SCHEMA_ID IN (SELECT SCHEMA_ID
						   FROM   sys.schemas
						   WHERE  NAME = 'dbo')
	 AND (ISNULL(@tablePrefix,'')='' or t.name LIKE [email protected]+'%')

	DECLARE @i INT
	DECLARE @i_max INT
	DECLARE @t_name VARCHAR(100)
	DECLARE @col_name VARCHAR(100)
	DECLARE @col_desc NVARCHAR(200)
	SET @i=1
	SELECT @i_max=COUNT(1) FROM @t1
	WHILE @i<[email protected]_max
		BEGIN
			SELECT @t_name=tablename,@col_name=COLUMNNAME,@col_desc=columndesc FROM @t1 WHERE [email protected]
			IF @overrideDesc=1
				begin
					IF EXISTS(SELECT 1 FROM dc_util_column_desc WHERE [email protected]_name AND [email protected]_name)
						UPDATE dc_util_column_desc SET columnDesc = @col_desc WHERE [email protected]_name AND [email protected]_name
					ELSE
						INSERT INTO dc_util_column_desc(tablename,columnName,columnDesc) VALUES (@t_name,@col_name,@col_desc)
				END
			ELSE
				BEGIN
					IF NOT EXISTS(SELECT 1 FROM dc_util_column_desc WHERE [email protected]_name AND [email protected]_name )
						INSERT INTO dc_util_column_desc(tablename,columnName,columnDesc) VALUES (@t_name,@col_name,@col_desc)
				END
			set @[email protected]+1
		END
END
GO
--2.4 存储过程
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Proc_Util_Desc_SetDescToTable]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[Proc_Util_Desc_SetDescToTable]
GO
-- =============================================
-- Author:
-- Create date: 2014-05-29
-- Description:	将 dc_util_table_desc 表中的 tableDesc 写到相应表的扩展属性
--				@tablePrefix 为表前缀 假设为 '' 或者 null, 则为所有表(默觉得null)
-- =============================================
CREATE PROCEDURE [dbo].[Proc_Util_Desc_SetDescToTable]
	@tablePrefix varchar(100) = null
AS
BEGIN
	SET NOCOUNT ON
	--删除表中无效的数据
	exec Proc_Util_Desc_DeleteInvalidData

	--定义表变量
	DECLARE @t1 TABLE(rn int IDENTITY(1,1),tablename VARCHAR(100),tabledesc NVARCHAR(200))
	--插入须要改动扩展属性的数据到表变量@t1
	INSERT INTO @t1
	(
		tablename,
		tabledesc
	)
	SELECT tablename,tabledesc FROM dc_util_table_desc
	WHERE ISNULL(@tablePrefix,'')='' OR tablename LIKE [email protected]+'%'
	--循环表变量中的数据
	DECLARE @i INT
	DECLARE @i_max INT
	DECLARE @t_name VARCHAR(100)
	DECLARE @t_desc NVARCHAR(200)
	SET @i=1
	SELECT @i_max=COUNT(1) FROM @t1
	WHILE @i<[email protected]_max
		BEGIN
			SELECT @t_name=tablename,@t_desc=tabledesc FROM @t1 WHERE [email protected]
			IF isnull(@t_desc,'')=''
			BEGIN
				SET @[email protected]+1
				CONTINUE
			END
			--假设表上存在MS_Description就update,不存在就insert
			IF EXISTS (SELECT p.value
						FROM   sys.tables                         AS t
							   LEFT JOIN sys.extended_properties  AS p
									ON  p.major_id = t.object_id
						WHERE  t.SCHEMA_ID IN (SELECT SCHEMA_ID
											   FROM   sys.schemas
											   WHERE  NAME = 'dbo')
						AND		p.minor_id = 0
						AND		p.class = 1
						AND		p.name = 'MS_Description'
						AND		t.name [email protected]_name)
				BEGIN
					EXEC sp_updateextendedproperty
							@name = N'MS_Description'
							,@value = @t_desc
							,@level0type = N'Schema', @level0name = 'dbo'
							,@level1type = N'Table',  @level1name = @t_name
				END
			ELSE
				BEGIN
						EXEC sp_addextendedproperty
							@name = N'MS_Description'
							,@value = @t_desc
							,@level0type = N'Schema', @level0name = 'dbo'
							,@level1type = N'Table',  @level1name = @t_name
				END
			SET @[email protected]+1
		END
END
GO
--2.5 存储过程
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Proc_Util_Desc_SetDescToColumn]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[Proc_Util_Desc_SetDescToColumn]
GO
-- =============================================
-- Author:
-- Create date: 2014-05-29
-- Description:	将dc_util_column_desc 表中的 columnDesc 写到相应表相应列的扩展属性
--              @tablePrefix 为表前缀 假设为 '' 或者 null, 则为所有表(默觉得null)
-- =============================================
CREATE PROCEDURE [dbo].[Proc_Util_Desc_SetDescToColumn]
	@tablePrefix varchar(100) = null
AS
BEGIN
	SET NOCOUNT ON
	--删除表中无效的数据
	exec Proc_Util_Desc_DeleteInvalidData

	--定义表变量
	DECLARE @t1 TABLE(rn int IDENTITY(1,1),tablename VARCHAR(100),columnname VARCHAR(100),columndesc NVARCHAR(200))
	-- 插入须要改动扩展属性的数据到表变量@t1
	INSERT INTO @t1
	(
		tablename,
		columnname,
		columndesc
	)
	SELECT tablename,columnname,columndesc FROM dc_util_column_desc
	WHERE ISNULL(@tablePrefix,'')='' or tablename LIKE [email protected]+'%'

	--循环表变量中的数据
	DECLARE @i INT
	DECLARE @i_max INT
	DECLARE @t_name VARCHAR(100)
	DECLARE @col_name VARCHAR(100)
	DECLARE @col_desc NVARCHAR(200)
	SET @i=1
	SELECT @i_max=COUNT(1) FROM @t1
	WHILE @i<[email protected]_max
		BEGIN
			SELECT @t_name=tablename,@col_name=columnname,@col_desc=columndesc FROM @t1 WHERE [email protected]

			IF ISNULL(@col_desc,'')=''
			BEGIN
				SET @[email protected]+1
				CONTINUE
			END

			--假设列上存在MS_Description就update,不存在就add
			IF EXISTS (SELECT  p.value
						FROM   sys.tables AS t
							   LEFT JOIN sys.extended_properties AS p ON  p.major_id = t.object_id
							   LEFT JOIN sys.columns c ON t.object_id=c.object_id AND c.column_id=p.minor_id
						WHERE  t.SCHEMA_ID IN (SELECT SCHEMA_ID
											   FROM   sys.schemas
											   WHERE  NAME = 'dbo')
							   AND p.class = 1
							   AND p.minor_id!=0
							   AND p.name = 'MS_Description'
							   AND t.name = @t_name
							   AND c.name = @col_name)
				BEGIN
					EXEC sp_updateextendedproperty
							@name = N'MS_Description'
							,@value = @col_desc
							,@level0type = N'Schema', @level0name = 'dbo'
							,@level1type = N'Table',  @level1name = @t_name
							,@level2type = N'Column', @level2name = @col_name
				END
			ELSE
				BEGIN
						EXEC sp_addextendedproperty
							@name = N'MS_Description'
							,@value = @col_desc
							,@level0type = N'Schema', @level0name = 'dbo'
							,@level1type = N'Table',  @level1name = @t_name
							,@level2type = N'Column', @level2name = @col_name
				END
			SET @[email protected]+1
		END
END
GO
--3.1 触发器
IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[Trig_dc_util_table_desc_I_U]'))
	DROP TRIGGER [dbo].[Trig_dc_util_table_desc_I_U]
GO
-- =============================================
-- Author:
-- Create date: 2014-05-29
-- Description:	将记录更新到相应表的扩展属性
-- =============================================
CREATE TRIGGER [dbo].[Trig_dc_util_table_desc_I_U]
   ON [dbo].[dc_util_table_desc]
   AFTER INSERT , UPDATE
AS
BEGIN
	--触发Proc_Util_SetDescToTable 更新表描写叙述
	DECLARE @m VARCHAR(100)
	SELECT @m=tablename FROM inserted
	EXEC Proc_Util_Desc_SetDescToTable @[email protected]
END
--3.2 触发器
IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[Trig_dc_util_column_desc_I_U]'))
	DROP TRIGGER [dbo].[Trig_dc_util_column_desc_I_U]
GO
-- =============================================
-- Author:
-- Create date: 2014-05-29
-- Description:	将记录更新到相应列的扩展属性
-- =============================================
CREATE TRIGGER [dbo].[Trig_dc_util_column_desc_I_U]
   ON [dbo].[dc_util_column_desc]
   AFTER INSERT , UPDATE
AS
BEGIN
	--触发Proc_Util_SetDescToColumn 去更新列描写叙述
	DECLARE @m VARCHAR(100)
	SELECT @m=tablename FROM inserted
	EXEC Proc_Util_Desc_SetDescToColumn @[email protected]
END
--4.1 查看表的描写叙述
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fun_GetTableStru]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
	DROP FUNCTION [dbo].[Fun_GetTableStru]
GO
-- =============================================
-- Author:
-- Create date: 2014-03-27
-- Description:	获取表结构
-- Demo: select * from [dbo].[Fun_GetTableStru]('表名')
-- =============================================
CREATE FUNCTION [dbo].[Fun_GetTableStru]
(
	@tableName NVARCHAR(MAX)
)
RETURNS TABLE
AS
RETURN
(

SELECT
	ac.column_id AS columnId
    ,AC.[name] AS columnName
    ,TY.[name] AS dataType
    ,AC.max_length AS maxLength
    ,AC.[is_nullable] isNullable
    ,CASE WHEN AC.[name] in
		(SELECT COLUMN_NAME = convert(sysname,c.name) from sysindexes i, syscolumns c, sysobjects o where o.id = object_id(@tableName)
			and o.id = c.id
			and o.id = i.id
			and (i.status & 0x800) = 0x800
			and (
			c.name = index_col (@tableName, i.indid,  1) or
			c.name = index_col (@tableName, i.indid,  2) or
			c.name = index_col (@tableName, i.indid,  3) or
			c.name = index_col (@tableName, i.indid,  4) or
			c.name = index_col (@tableName, i.indid,  5) or
			c.name = index_col (@tableName, i.indid,  6) or
			c.name = index_col (@tableName, i.indid,  7) or
			c.name = index_col (@tableName, i.indid,  8) or
			c.name = index_col (@tableName, i.indid,  9) or
			c.name = index_col (@tableName, i.indid, 10) or
			c.name = index_col (@tableName, i.indid, 11) or
			c.name = index_col (@tableName, i.indid, 12) or
			c.name = index_col (@tableName, i.indid, 13) or
			c.name = index_col (@tableName, i.indid, 14) or
			c.name = index_col (@tableName, i.indid, 15) or
			c.name = index_col (@tableName, i.indid, 16)
			)) THEN 1 ELSE 0 END AS isPK
	,CASE WHEN AC.[name] IN (
            SELECT t1.name
            FROM   (
                       SELECT col.name,
                              f.constid       AS temp
                       FROM   syscolumns col,
                              sysforeignkeys     f
                       WHERE  f.fkeyid = col.id
                              AND f.fkey = col.colid
                              AND f.constid IN (SELECT DISTINCT(id)
                                                FROM   sysobjects
                                                WHERE  OBJECT_NAME(parent_obj) =
                                                       @tableName
                                                       AND xtype = 'F')
                   )  AS t1,
                   (
                       SELECT OBJECT_NAME(f.rkeyid)  AS rtableName,
                              col.name,
                              f.constid              AS temp
                       FROM   syscolumns col,
                              sysforeignkeys            f
                       WHERE  f.rkeyid = col.id
                              AND f.rkey = col.colid
                              AND f.constid IN (SELECT DISTINCT(id)
                                                FROM   sysobjects
                                                WHERE  OBJECT_NAME(parent_obj) =
                                                       @tableName
                                                       AND xtype = 'F')
                   )  AS t2
            WHERE  t1.temp = t2.temp
    ) THEN 1 ELSE 0 END AS isFK
    ,(SELECT COLUMNPROPERTY( OBJECT_ID(@tableName),ac.name,'IsIdentity')) AS isIdentity
    ,ISNULL(t2.[DESCRIPTION], '') AS [columnDesc]
	,ISNULL((
		SELECT ISNULL(VALUE, '')
       FROM   sys.extended_properties ex_p
       WHERE  ex_p.minor_id = 0
              AND ex_p.major_id = t.OBJECT_ID
	),'') AS [tableDesc]
FROM    sys.[tables] AS T
        INNER JOIN sys.[all_columns] AC ON T.[object_id] = AC.[object_id]
        INNER JOIN sys.[types] TY ON AC.[system_type_id] = TY.[system_type_id]
                                     AND AC.[user_type_id] = TY.[user_type_id]
		LEFT JOIN (
                    SELECT DISTINCT(sys.columns.name),
                           (
                               SELECT VALUE
                               FROM   sys.extended_properties
                               WHERE  sys.extended_properties.major_id = sys.columns.object_id
                                      AND sys.extended_properties.minor_id = sys.columns.column_id
                           ) AS DESCRIPTION
                    FROM   sys.columns,
                           sys.tables,
                           sys.types
                    WHERE  sys.columns.object_id = sys.tables.object_id
                           AND sys.columns.system_type_id = sys.types.system_type_id
                           AND sys.tables.name = @tableName
                ) AS t2  ON AC.name=t2.name
WHERE   T.[is_ms_shipped] = 0 AND [email protected]

)
GO
时间: 2024-10-14 20:43:20

用表来管理SQLServer中的扩展属性(描写叙述)的相关文章

用表来管理SQLServer中的扩展属性(描述)

数据字典是个好东东,对于开发.维护非常重要. 但Sql Server中写描述确实不方便,如何化繁为简.批量地增加修改扩展属性呢? 增加2个表和5个存储过程.2个触发器.1个表值函数就好了. 把下面的SQL执行一遍生成相关的对象, 然后执行一下: 1. EXEC Proc_Util_Desc_GetColumnNameToDescTable , 生成表的描述对应记录 2. EXEC Proc_Util_Desc_GetTableNameToDescTable, 生成列的描述对应记录 3. 查看,

FME中Cass扩展属性转Shp的方法

问题:真受不了CAD中的注记,只能方便显示,难于数据交互.好在Cass把属性信息基本写在扩展属性中,但显示又成问题了.此事难两全!我们通过查看实体属性,需要把宗地界线的扩展属性提取出来.即组码为-3,South中的宗地号.户主名和地类代码提取出来. 分析:曾写过一个标注写入面属性的程序,最近又写了操作Cass扩展属性的程序,我想把两者结合起来解决此问题. 但在整理文档时,又发现了FME的安装,我想起了FME可以实现这个吧! 安装FME2014版本,用fmedatainspector打开处理后的C

SQLServer中使用扩展事件获取Session级别的等待信息以及SQLServer 2016中Session级别等待信息的增强

本文出处:http://www.cnblogs.com/wy123/p/6835939.html 什么是等待 简单说明一下什么是等待:当应用程序对SQL Server发起一个Session请求的时候,这个Session请求在数据库中执行的过程中会申请其所需要的资源,比如可能会申请内存资源,表上的锁资源,物理IO资源,网络资源等等,如果当前Session运行过程中需要申请的某些资源无法立即得到满足,就会产生等待.SQL Server会以不用的方式来展现这个等待信息,比活动Session的等待信息,

CDH中,如果管理CM中没有的属性

在CM配置管理中的"hive-site.xml 的 Hive 客户端高级配置代码段(安全阀)""仅适用于高级使用,逐个将字符串插入 hive-site.xml 的客户端配置." 举的是hive的例子,其它项目中也是在类似字段添加属性. 添加个截图吧,截图如下:

SQL Server扩展属性的增、删、改、查

使用 sql 语句创建表时,可以使用系统存储过程 sp_addextendedproperty 给字段添加描述说明. sp_addextendedproperty 语法: 1 sp_addextendedproperty 2 [ @name = ] { 'property_name' } 3 [ , [ @value = ] { 'value' } 4 [ , [ @level0type = ] { 'level0_object_type' } 5 , [ @level0name = ] { '

每天进步一点点——Linux中的文件描写叙述符与打开文件之间的关系

转载请说明出处:http://blog.csdn.net/cywosp/article/details/38965239 1. 概述 在Linux系统中一切皆能够看成是文件,文件又可分为:普通文件.文件夹文件.链接文件和设备文件.文件描写叙述符(file descriptor)是内核为了高效管理已被打开的文件所创建的索引.其是一个非负整数(一般是小整数),用于指代被打开的文件.全部运行I/O操作的系统调用都通过文件描写叙述符.程序刚刚启动的时候.0是标准输入,1是标准输出,2是标准错误. 假设此

Kotlin入门(33)运用扩展属性

进行App开发的时候,使用震动器要在AndroidManifest.xml中加上如下权限: <!-- 震动 --> <uses-permission android:name="android.permission.VIBRATE" /> 让手机震动的功能用到了震动器Vibrator类,而震动器对象从系统服务VIBRATOR_SERVICE获得,实现该功能的代码很简单,即便用Java书写也只有以下两行代码: Vibrator vibrator = (Vibrat

【C#】使用IExtenderProvider为控件添加扩展属性,像ToolTip那样

申明: - 本文适用于WinForm开发 - 文中的“控件”一词是广义上的说法,泛指包括ToolStripItem.MenuItem在内单个界面元素,并不特指继承自Control类的狭义控件 用过ToolTip这个组件的童鞋都知道这样一个现象:在VS中拖入一个ToolTip,然后点击窗体中的各种控件,在其属性窗格中就会多出一个叫ToolTip的属性出来,如图: 本文要说的就是如何像ToolTip这样,为控件“扩展”出一个属性来(之所以用引号,是因为并不是真的为控件增加了一个属性,而是在VS中看起

解决ora-01652无法通过128(在temp表空间中)扩展temp段的过程

解决ora-01652无法通过128(在temp表空间中)扩展temp段的过程 昨天开发人员跟我说,执行一个sql语句后,大约花了10分钟,好不容易有一个结果,但是报了一个ora-01652错误,查阅了oracle的错误代码说明:意思是指temp表空间无法自动扩展temp段.这种问题一般有两种原因:一是临时表空间空间太小,二是不能自动扩展. 分析过程: 既然是temp表空间有问题,那当然就要从temp表空间说起啦.首先要说明的是temp表空间的作用,temp表空间主要是用作需要排序的操作. 1.