SqlServer中常常搞不清楚 sp_columns来看一看

The sp_columns catalog stored procedure is equivalent to SQLColumns in ODBC. The results returned are ordered by TABLE_QUALIFIER, TABLE_OWNER, and TABLE_NAME.

Column nameData typeDescription
TABLE_QUALIFIERsysnameObject qualifier name. This field can be NULL.
TABLE_OWNERsysnameObject owner name. This field always returns a value.
TABLE_NAMEsysnameObject name. This field always returns a value.
COLUMN_NAMEsysnameColumn name, for each column of the TABLE_NAME returned. This field always returns a value.
DATA_TYPEsmallintInteger 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_NAMEcolumn.
TYPE_NAMEsysnameString representing a data type. The underlying DBMS presents this data type name.
PRECISIONintNumber of significant digits. The return value for the PRECISION column is in base 10.
LENGTHintTransfer size of the data.1
SCALEsmallintNumber of digits to the right of the decimal point.
RADIXsmallintBase for numeric data types.
NULLABLEsmallintSpecifies nullability.

1 = NULL is possible.

0 = NOT NULL.
REMARKSvarchar(254)This field always returns NULL.
COLUMN_DEFnvarchar(4000)Default value of the column.
SQL_DATA_TYPEsmallintValue 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 intervaldata types. This column always returns a value.
SQL_DATETIME_SUBsmallintSubtype code for datetime and SQL-92 interval data types. For other data types, this column returns NULL.
CHAR_OCTET_LENGTHintMaximum length in bytes of a character or integer data type column. For all other data types, this column returns NULL.
ORDINAL_POSITIONintOrdinal position of the column in the object. The first column in the object is 1. This column always returns a value.
IS_NULLABLEvarchar(254)Nullability of the column in the object. 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_TYPEtinyintSQL Server data type used by extended stored procedures. For more information, see Data Types (Transact-SQL).

1 For more information, see the Microsoft ODBC documentation.

转载于:https://www.cnblogs.com/qianjinyan/p/6729760.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值