Home > Database > Mysql Tutorial > SQL 判断字段类型语句

SQL 判断字段类型语句

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:59:24
Original
1760 people have browsed it

SQL 判断字段类型语句实现代码。

-->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')
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template