标签:md5值 extend mamicode cal int tor rgb 允许 活跃度
查看数据表的信息,只能算是优化用户体验
--用户表 if exists(select * from sysobjects where name = ‘bi_user‘) drop table bi_user create table bi_user ( user_id int not null primary key, --id,主键 user_pwd varchar(100) not null, --密码MD5值 user_no varchar(20) not null, --用户号,和微信号一样的功能 user_name NVARCHAR(20) not null, --用户名称 user_tel varchar(11) null, --固话 user_mobile VARCHAR(11) not null, --电话号码 user_wechat VARCHAR(100) null, --用户微信 user_cardid VARCHAR(20) null, --身份证号 user_sex char(1) null, --性别:0男,1女,3其他 user_weight DECIMAL(5,1) not null default 0, --重量,单位是KG user_height DECIMAL(5,1) not null default 0, --身高,单位是CM user_age int not null, --年龄 birth_date DATETIME not null, --用户生日 user_remarks NVARCHAR(500) null, --个人简介 user_status VARCHAR(2) not null, --状态:0正常,1停用,2封号 user_type varchar(4) not null default ‘E‘, --用户类型:SS(SS级),S(S级),A(A级),B(B级),C(C级),D(D级),E(E级) activity_level VARCHAR(4) not null default ‘1‘, --活跃度级别,1~20,对应1级到20级 stored_amt DECIMAL(24,2) not null default 3, --欢乐豆子,新用户注册有3颗豆子,充值:1元=1豆 ) create index IX_bi_user_user_no_user_mobile on bi_user(user_no asc,user_mobile asc);
--快速查看表结构 SELECT CASE WHEN col.colorder = 1 THEN obj.name ELSE ‘‘ END AS 表名, col.colorder AS 序号 , col.name AS 列名 , ISNULL(ep.[value], ‘‘) AS 列说明 , t.name AS 数据类型 , col.length AS 长度 , ISNULL(COLUMNPROPERTY(col.id, col.name, ‘Scale‘), 0) AS 小数位数 , CASE WHEN COLUMNPROPERTY(col.id, col.name, ‘IsIdentity‘) = 1 THEN ‘1‘ ELSE ‘‘ END AS 标识 , CASE WHEN EXISTS ( SELECT 1 FROM dbo.sysindexes si INNER JOIN dbo.sysindexkeys sik ON si.id = sik.id AND si.indid = sik.indid INNER JOIN dbo.syscolumns sc ON sc.id = sik.id AND sc.colid = sik.colid INNER JOIN dbo.sysobjects so ON so.name = si.name AND so.xtype = ‘PK‘ WHERE sc.id = col.id AND sc.colid = col.colid ) THEN ‘1‘ ELSE ‘‘ END AS 主键 , CASE WHEN col.isnullable = 1 THEN ‘1‘ ELSE ‘‘ END AS 允许空 , ISNULL(comm.text, ‘‘) AS 默认值 FROM dbo.syscolumns col LEFT JOIN dbo.systypes t ON col.xtype = t.xusertype inner JOIN dbo.sysobjects obj ON col.id = obj.id AND obj.xtype = ‘U‘ AND obj.status >= 0 LEFT JOIN dbo.syscomments comm ON col.cdefault = comm.id LEFT JOIN sys.extended_properties ep ON col.id = ep.major_id AND col.colid = ep.minor_id AND ep.name = ‘MS_Description‘ LEFT JOIN sys.extended_properties epTwo ON obj.id = epTwo.major_id AND epTwo.minor_id = 0 AND epTwo.name = ‘MS_Description‘ WHERE obj.name = ‘bi_user‘--表名 ORDER BY col.colorder ;
效果如下:
标签:md5值 extend mamicode cal int tor rgb 允许 活跃度
原文地址:https://www.cnblogs.com/yang315/p/14458820.html