Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



INFORMATION_SCHEMA.ROUTINE_COLUMNS

 

This is a view in the mssqlsystemresource database.




Syntax
CREATE VIEW INFORMATION_SCHEMA.ROUTINE_COLUMNS
AS
SELECT
	DB_NAME()						AS TABLE_CATALOG,
	SCHEMA_NAME(o.schema_id)			AS TABLE_SCHEMA,
	o.name							AS TABLE_NAME,
	c.name							AS COLUMN_NAME,
	c.column_id						AS ORDINAL_POSITION,
	convert(nvarchar(4000),
		object_definition(c.default_object_id))			AS COLUMN_DEFAULT,
	convert(varchar(3),
		CASE WHEN c.is_nullable = 1 THEN 'YES'
		ELSE 'NO' END)				AS IS_NULLABLE,
	ISNULL(type_name(c.system_type_id), t.name)		AS DATA_TYPE,
	ColumnProperty(c.object_id, c.name, 'charmaxlen')	AS CHARACTER_MAXIMUM_LENGTH,
	ColumnProperty(c.object_id, c.name, 'octetmaxlen')	AS CHARACTER_OCTET_LENGTH,
	convert(tinyint, CASE -- int/decimal/numeric/real/float/money
		WHEN c.system_type_id IN (48, 52, 56, 59, 60, 62, 106, 108, 122, 127) THEN c.precision
		END)										AS NUMERIC_PRECISION,
	convert(smallint, CASE	-- int/money/decimal/numeric
		WHEN c.system_type_id IN (48, 52, 56, 60, 106, 108, 122, 127) THEN 10
		WHEN c.system_type_id IN (59, 62) THEN 2 END)	AS NUMERIC_PRECISION_RADIX, -- real/float
	convert(int, CASE	-- datetime/smalldatetime
		WHEN c.system_type_id IN (40, 41, 42, 43, 58, 61) THEN NULL
		ELSE odbcscale(c.system_type_id, c.scale) END)	AS NUMERIC_SCALE,
	convert(smallint, CASE -- datetime/smalldatetime
		WHEN c.system_type_id IN (40, 41, 42, 43, 58, 61) THEN odbcscale(c.system_type_id, c.scale) END)	AS DATETIME_PRECISION,
	convert( sysname, null)					AS CHARACTER_SET_CATALOG,
	convert( sysname, null)					AS CHARACTER_SET_SCHEMA,
	convert( sysname, CASE
		WHEN c.system_type_id IN (35, 167, 175)	-- char/varchar/text
		THEN CollationProperty(c.collation_name, 'sqlcharsetname')
		WHEN c.system_type_id IN (99, 231, 239)	-- nchar/nvarchar/ntext
		THEN N'UNICODE'	END)				AS CHARACTER_SET_NAME,
	convert(sysname, null)					AS COLLATION_CATALOG,
	convert(sysname, null)					AS COLLATION_SCHEMA,
	c.collation_name					AS COLLATION_NAME,
	convert(sysname,
		CASE WHEN c.user_type_id > 256
		THEN DB_NAME() END)				AS DOMAIN_CATALOG,
	convert(sysname,
		CASE WHEN c.user_type_id > 256 THEN
		SCHEMA_NAME(t.schema_id) END)			AS DOMAIN_SCHEMA,
	convert(sysname,
		CASE WHEN c.user_type_id > 256 THEN
		type_name(c.user_type_id) END)			AS DOMAIN_NAME
FROM
	sys.objects o JOIN sys.columns c ON c.object_id = o.object_id
	LEFT JOIN sys.types t ON c.user_type_id = t.user_type_id
WHERE
	o.type IN ('TF','IF', 'FT')

 
Last revision 2008RTM
News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash