Click here to Skip to main content
15,887,411 members
Articles / Database Development / SQL Server

DACBuilder – Data Access objects generation tool based on XML and XSL templates transformation

Rate me:
Please Sign up or sign in to vote.
5.00/5 (13 votes)
31 Mar 2006CPOL23 min read 76K   1.9K   68  
The DACBuilder application provides auto-generation features from multiple database systems in multiple programming languages.
IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME = 'fnGetExtendedProperty')
BEGIN
	DROP FUNCTION fnGetExtendedProperty
END
GO


/*
	name: fnGetExtendedProperty
	type: scalar function
		returns sql_variant
	parameters:
		@property_name sysname,		-- extended property name (usually, N'MS_Description')
		@table_name varchar(128), 	-- table name for specified column to retrieve extended property
		@column_name varchar(128) 	-- column name to retrieve extended property
	scope: uses global function ::fn_listextendedproperty to retrieve a 
		value from an extended property added to a column in a table
*/

CREATE  FUNCTION fnGetExtendedProperty(
		@property_name sysname,		-- extended property name (usually, N'MS_Description')
		@table_name varchar(128), 	-- table name for specified column to retrieve extended property
		@column_name varchar(128) 	-- column name to retrieve extended property
)
RETURNS SQL_VARIANT
AS
BEGIN
	DECLARE @value SQL_VARIANT
	SELECT @value = VALUE FROM ::fn_listextendedproperty(
			@property_name, 'USER', 'dbo', 'table', @table_name, 'COLUMN', @column_name
		)
	RETURN @value
END

GO

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Telstra Internet
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions