sql获取指定表所有列名及注释】的更多相关文章

SELECT b.name as 字段名 ,Type_name(b.xusertype) as 字段类型, Isnull(c.VALUE,'') as 字段说明FROM sysobjects a join syscolumns b on a.id = b.id JOIN sys.extended_properties c ON b.id = c.major_id AND b.colid = c.minor_id WHERE a.id = Object_id('gbpm.JLFFORM3') --…
My SQL获取某个表的列名 DESC TableName SHOW COLUMNS FROM TableName SELECT COLUMN_NAME  FROM information_schema.columns WHERE table_name='tablename'…
/* --作用:根据特定的表名查询出字段,以及描述,数据类型,长度,精度,是否自增,是否为空等信息 --作者:wonder QQ:37036846 QQ群:.NET顶级精英群 ID:124766907 --时间:2011-03-23 11:25 --描述:创建存储过程 --参数:@tableName 表名 */ CREATE PROC sp_GetListsColumnInfoByTableName( )) AS BEGIN then '主键' ELSE '' END IS_KEYS, x.ob…
1.获取指定表的行数 --获取表中数据行数 --select max([列名]) from 表名 2.筛选指定表的指定行数据(数据表分页获取) http://www.cnblogs.com/morningwang/archive/2009/01/02/1367277.html --MAX方法实现筛选指定范围行的数据 * FROM hduCV1507022250 WHERE [recID] > ( --SELECT ISNULL(MAX([recID]),0) SELECT MAX(recID)…
1.很多时候我们需要从数据库中获取指定表的所有列的相关属性,如 name,commens,datatype,datalength,pk等.下面就是制定的语句. select c.TABLE_NAME TABLE_CODE, t.comments TABLE_NAME, C.COLUMN_NAME COL_CODE, c2.comments COL_NAME, c.DATA_TYPE COL_TYPE, decode(c.NULLABLE,') NULLABLE, c.DATA_LENGTH, c…
表的列名比较多的时候,手工一个个的写列名比较麻烦,这个函数可以让人偷偷懒 create or replace function f_GetCols(p_TableName in varchar2/*获取表中所有列名 前后添加select from*/)  RETURN varchar2isResult  varchar2(2000);v_cnts number;v_strTabName varchar2(200);BEGIN v_strTabName:=upper(p_tablename); s…
方法1:[仅指定表名] select COLUMN_NAME from information_schema.COLUMNS where table_name = 'your-table-name'; 方法2:[指定表名+数据库名] select COLUMN_NAME from information_schema.COLUMNS where table_name = 'your-table-name' and table_schema = 'your-DB-name'; ==========…
//////////////////查询指定表外键约束select a.name as 约束名, object_name(b.parent_object_id) as 外键表, d.name as 外键列, object_name(b.referenced_object_id) as 主健表, c.name as 主键列 from sys.foreign_keys A inner join sys.foreign_key_columns B on A.object_id=b.constraint…
IDENT_CURRENT('TableName')为当前的最大标识值, IDENT_INCR('TableName')为设置的标识值增量, 两者相加即为下一个标识值 如: SELECT IDENT_CURRENT('TableName') + IDENT_INCR('TableName');…
SELECT syscolumns.name,systypes.name,syscolumns.isnullable,syscolumns.length FROM syscolumns, systypes WHERE syscolumns.xusertype = systypes.xusertype AND syscolumns.id = object_id('ChildrenCustomer') and syscolumns.name like '%obile'…