标签:number end evel eve sel mat substr pgsql 位长
1. 添加表字段
=CONCAT("alter table ","表名"," add ",字段名," ",字段,";") 或者 =CONCAT("alter table ","表名"," add ",字段名," ",字段类型,"(",长度,",",精度,");")
2.给字段加注释
=CONCAT("comment on column ","表名",".",字段名," is ","‘",注释,"‘;") ---pgsql
=CONCAT("EXEC sys.sp_addextendedproperty @name = N‘MS_Description‘, @value = N‘",注释,"‘, @level0type = N‘SCHEMA‘, @level0name = N‘dbo‘, @level1type = N‘TABLE‘, @level1name = N‘","表名","‘, @level2type = N‘COLUMN‘, @level2name = N‘",字段名,"‘;") ---SQL server
可根据Excel 自由拼接。
3.查表序号,栏位名称,栏位长度,栏位说明 (注:表中无注释则不显示)
select row_number() over () 序号,
a.attname 栏位名称,
concat_ws(‘‘, t.typname, SUBSTRING(format_type(a.atttypid, a.atttypmod) from ‘\(.*\)‘)) as 栏位长度,
d.description 栏位说明
from pg_class c,
pg_attribute a,
pg_type t,
pg_description d
where a.attnum > 0
and a.attrelid = c.oid
and a.atttypid = t.oid
and d.objoid = a.attrelid
and d.objsubid = a.attnum
and c.relname = ‘表名‘
order by c.relname, a.attnum;
标签:number end evel eve sel mat substr pgsql 位长
原文地址:https://www.cnblogs.com/Learn-not-to-have-already/p/11994348.html