修改表字段语句: alter table 表名 alter column 字段名 set data type varchar(7700) 如: ALTER TABLE JV_BI_BACK_OPER_LOG alter column OPERATION_DESC set DATA TYPE varchar(7700) 查看表字段语句:select *from syscat.columns where tabname = '表名' and colname = '表列名',如: select *
1.mysql查看表字段和字段描述 SELECT column_name, column_comment FROM information_schema.columns WHERE table_schema ='hsex_dev_2271' AND table_name = 'channel_trade_detail'; 结果:
select column_name,data_type,DATA_LENGTH From all_tab_columns where table_name=upper('表名') AND owner=upper('数据库登录用户名') select column_name,data_type,DATA_LENGTH From all_tab_columns where table_name=upper('Mid_Payinfo') AND owner=upper('cgtest') creat
MySql: show full columns from tableName; Sql server: SELECT A.name AS table_name, B.name AS column_name, C.value AS column_description FROM sys.tables AS A INNER JOIN sys.columns AS B ON B.object_id = A.object_id LEFT OUTER JOIN sys.extended_properti
select A.comments,A.column_name,B.DATA_TYPE||'('||B.DATA_LENGTH||')' from user_col_comments A inner join USER_TAB_COLS B on A.table_name=B.TABLE_NAME and A.column_name=B.COLUMN_NAME and A.TABLE_NAME='BASE_DRUGINFO' order by B.COLUMN_ID;
今天突然遇到有人要数据库表及表字段说明,数据库表太多又不能一个个表去找,就想想SQL是否能直接查询出来. 经过查询资料,加上一些自己的一些调整写了一个sql语句,在此记录一下,以方便日后查找使用. SELECT ( CASE WHEN a.colorder = 1 THEN d.name ELSE '' END ) N'表名' , ( CASE WHEN a.colorder = 1 THEN ISNULL(h.value, '') ELSE '' END ) N'表说明' , a.colord