您现在的位置是:网站首页> 编程资料编程资料
SQL 判断字段类型语句_MsSql_
2023-05-26
302人已围观
简介 SQL 判断字段类型语句_MsSql_
-->Title:Generating test data
-->Author:wufeng4552
-->Date :2009-09-25 09:56:07
if object_id('tb')is not null drop table tb
go
create table tb(ID int,name text)
insert tb select 1,'test'
go
--方法1
select sql_variant_property(ID,'BaseType') from tb
--方法2
select object_name(ID)表名,
c.name 字段名,
t.name 数据类型,
c.prec 长度
from syscolumns c
inner join systypes t
on c.xusertype=t.xusertype
where objectproperty(id,'IsUserTable')=1 and id=object_id('tb')
-->Author:wufeng4552
-->Date :2009-09-25 09:56:07
if object_id('tb')is not null drop table tb
go
create table tb(ID int,name text)
insert tb select 1,'test'
go
--方法1
复制代码 代码如下:
select sql_variant_property(ID,'BaseType') from tb
--方法2
复制代码 代码如下:
select object_name(ID)表名,
c.name 字段名,
t.name 数据类型,
c.prec 长度
from syscolumns c
inner join systypes t
on c.xusertype=t.xusertype
where objectproperty(id,'IsUserTable')=1 and id=object_id('tb')
相关内容
- 用sql获取某字符串中的数字部分的语句_MsSql_
- 一些文件未注册导致mssql表文件无法找开的解决方法_MsSql_
- 系统存储过程sp_MSforeachtable和sp_MSforeachdb使用说明_MsSql_
- sqlserver 禁用触发器和启用触发器的语句_MsSql_
- SQLSERVER中union,cube,rollup,cumpute运算符使用说明_MsSql_
- 实现按关健字模糊查询,并按匹配度排序的SQL语句_MsSql_
- sqlserver 字符串分拆 语句_MsSql_
- MSSQL 提取汉字实现语句_MsSql_
- MSSQL 首字母替换成大写字母_MsSql_
- MSSQL 多字段根据范围求最大值实现方法_MsSql_
