SQL 判断字段类型语句
2009-09-25 00:00
633 查看
-->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
--方法2
-->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表关键字段的名称、数据类型和长度
- 一个表的两个字段具有相同的类型。如何仅用SQL语句交换这两列的数据?
- 用sql语句写入含blob类型字段的数据
- SQL语句如何判断某字段是以字母开头而不是汉字开头
- 查看Oracle执行计划的几种方法 / oracle中DateTime类型的字段,建立索引后,查寻时索引如何生效?/ oracle 中sql语句怎么加多个强制索引
- T-SQL 判断字段是否存在的SQL语句写法
- 小黑小波比.用sql语句加入表中的新字段和字段类型.
- mysql通过sql语句判断某个字段在一张表中是否存在
- oracle数据库表中,某个字段是varchar2类型的但其实存的是数字,这样安装该字段排序,排出来的顺序是不对的,sql语句怎么写就可以排序了?
- SQL语句判断指定的数据库、表、字段、存储过程是否存在
- SQL语句判断数据库、表、字段是否存在
- 读取sql server表的字段名,字段类型,字段长度,字段属性描述的sql语句
- 读取sql server表的字段名,字段类型,字段长度,字段属性描述的sql语句
- 中等难度SQL语句(存储过程,分页,拼接字段、游标,日期类型转换,动态行转列,视图)汇总
- MSSQL中如何用SQL语句查询字段类型?
- Access sql语句创建表及字段类型
- mysql 用sql语句查询一个表中的所有字段类型、注释
- SQL语句查看字段类型及精度
- sql的case语句中判断字段是否为null的写法