SaaS CMS has officially launched! Learn more now.

Class SystemStoredProcedure

Provides execution of system stored procedures.

Inheritance
System.Object
SystemStoredProcedure
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.BusinessFoundation.Data.Sql.Management
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 11.8.3
Syntax
public static class SystemStoredProcedure

Methods

ExecuteSpColumns(String)

Executes the sp_columns system stored procedure.

Declaration
public static IDataReader ExecuteSpColumns(string tableName)
Parameters
Type Name Description
System.String tableName

Name of the table.

Returns
Type Description
System.Data.IDataReader

Result Sets: TABLE_QUALIFIER sysname Table or view qualifier name. This field can be NULL. TABLE_OWNER sysname Table or view owner name. This field always returns a value. TABLE_NAME sysname Table or view name. This field always returns a value. COLUMN_NAME sysname Column name, for each column of the TABLE_NAME returned. This field always returns a value. DATA_TYPE smallint Integer code for ODBC data type. If this is a data type that cannot be mapped to an ODBC type, it is NULL. The native data type name is returned in the TYPE_NAME column. TYPE_NAME varchar(13) String representing a data type. The underlying DBMS presents this data type name. PRECISION int Number of significant digits. The return value for the PRECISION column is in base 10. LENGTH int Transfer size of the data. SCALE smallint Number of digits to the right of the decimal point. RADIX smallint Base for numeric datatypes. NULLABLE smallint Specifies nullability. 1 = NULL is possible. 0 = NOT NULL. REMARKS varchar(254)This field always returns NULL. COLUMN_DEF nvarchar(4000) Default value of the column. SQL_DATA_TYPE smallint Value of the SQL data type as it appears in the TYPE field of the descriptor. This column is the same as the DATA_TYPE column, except for the datetime and SQL-92 interval data types. This column always returns a value. SQL_DATETIME_SUB smallint Subtype code for datetime and SQL-92 interval data types. For other data types, this column returns NULL. CHAR_OCTET_LENGTH int Maximum length in bytes of a character or integer data type column. For all other data types, this column returns NULL. ORDINAL_POSITION int Ordinal position of the column in the table. The first column in the table is 1. This column always returns a value. IS_NULLABLE varchar(254) Nullability of the column in the table. ISO rules are followed to determine nullability. An ISO SQL-compliant DBMS cannot return an empty string. YES = Column can include NULLS. NO = Column cannot include NULLS. This column returns a zero-length string if nullability is unknown. The value returned for this column is different from the value returned for the NULLABLE column. SS_DATA_TYPE tinyint SQL Server data type, used by extended stored procedures. For more information, see Data Types.

ExecuteSpFKeys(String, String)

Returns logical foreign key information for the current environment. This procedure shows foreign key relationships including disabled foreign keys.

Declaration
public static IDataReader ExecuteSpFKeys(string pkTableName, string fkTableName)
Parameters
Type Name Description
System.String pkTableName

Name of the primary key table.

System.String fkTableName

Name of the foreign key table.

Returns
Type Description
System.Data.IDataReader

Result Sets: PKTABLE_QUALIFIER sysname Name of the table (with the primary key) qualifier. This field can be NULL. PKTABLE_OWNER sysname Name of the table (with the primary key) owner. This field always returns a value. PKTABLE_NAME sysname Name of the table (with the primary key). This field always returns a value. PKCOLUMN_NAME sysname Name of the primary key column(s), for each column of the TABLE_NAME returned. This field always returns a value. FKTABLE_QUALIFIER sysname Name of the table (with a foreign key) qualifier. This field can be NULL. FKTABLE_OWNER sysname Name of the table (with a foreign key) owner. This field always returns a value. FKTABLE_NAME sysname Name of the table (with a foreign key). This field always returns a value. FKCOLUMN_NAME varchar(32) Name of the foreign key column(s), for each column of the TABLE_NAME returned. This field always returns a value. KEY_SEQ smallint Sequence number of the column in a multicolumn primary key. This field always returns a value.
UPDATE_RULE smallint Action applied to the foreign key when the SQL operation is an update. SQL Server returns 0 or 1 for these columns. Open Data Services gateways can return values of 0, 1, or 2: 0=CASCADE changes to foreign key. 1=NO ACTION changes if foreign key is present. 2=SET_NULL; set foreign key to NULL. DELETE_RULE smallint Action applied to the foreign key when the SQL operation is a deletion. SQL Server returns 0 or 1 for these columns. Open Data Services gateways can return values of 0, 1, or 2: 0=CASCADE changes to foreign key. 1=NO ACTION changes if foreign key is present. 2=SET_NULL; set foreign key to NULL. FK_NAME sysname Foreign key identifier. It is NULL if not applicable to the data source. SQL Server returns the FOREIGN KEY constraint name. PK_NAME sysname Primary key identifier. It is NULL if not applicable to the data source. SQL Server returns the PRIMARY KEY constraint name.

ExecuteSpPKeys(String)

Returns primary key information for a single table in the current environment.

Declaration
public static IDataReader ExecuteSpPKeys(string tableName)
Parameters
Type Name Description
System.String tableName

Name of the table.

Returns
Type Description
System.Data.IDataReader

Result Sets: TABLE_QUALIFIER sysname Name of the table qualifier. This field can be NULL. TABLE_OWNER sysname Name of the table owner. This field always returns a value. TABLE_NAME sysname Name of the table. In SQL Server, this column represents the table name as listed in the sysobjects table. This field always returns a value. COLUMN_NAME sysname Name of the column, for each column of the TABLE_NAME returned. In SQL Server, this column represents the column name as listed in the syscolumns table. This field always returns a value. KEY_SEQ smallint Sequence number of the column in a multicolumn primary key.
PK_NAME sysname Primary key identifier. Returns NULL if not applicable to the data source.

ExecuteSpTables()

Executes the sp_tables system stored procedure.

Declaration
public static IDataReader ExecuteSpTables()
Returns
Type Description
System.Data.IDataReader

Result Sets: TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, TABLE_TYPE, REMARKS

ExecuteSpTables(String, String, String, String)

Executes the sp_tables system stored procedure.

Declaration
public static IDataReader ExecuteSpTables(string tableName, string tableOwner, string tableQualifier, string tableType)
Parameters
Type Name Description
System.String tableName

Is the table used to return catalog information. name is nvarchar(384), with a default of NULL. Wildcard pattern matching is supported.

System.String tableOwner

Is the table owner of the table used to return catalog information. owner is nvarchar(384), with a default of NULL. Wildcard pattern matching is supported.

System.String tableQualifier

Is the name of the table qualifier. qualifier is sysname, with a default of NULL.

System.String tableType

Is a list of values, separated by commas, that gives information about all tables of the table type(s) specified, including TABLE, SYSTEM TABLE, and VIEW.

Returns
Type Description
System.Data.IDataReader

Result Sets: TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, TABLE_TYPE, REMARKS