mysql数据库字段中 判断字段中字符类型 问题

mysql数据库字段中 判断字段中字符类型 问题,第1张

您如果想要判断类型的话,可以进行转换 比如

select to_char(name) from table_name ---这样就把您想要的数据NAME列转换为字符型

select to_num(name) from table_name ---这样就把您想要的数据NAME列转换为数字型

您所说的自动判断 貌似没有

elect a.name as [column],b.name as type

from syscolumns a,systypes b

where a.id=object_id('表名') and a.xtype=b.xtype

把“表名”替换成你要查看字段类型的表名,比如你要查看sysobjects表的各字段类型那么就是

select a.name as [column],b.name as type

from syscolumns a,systypes b

where a.id=object_id('sysobjects') and a.xtype=b.xtype

另外可以通过存储过程

exec sp_help 表名


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7104650.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-01
下一篇 2023-04-01

发表评论

登录后才能评论

评论列表(0条)

保存