实用滴sql语句

 

/*根据列名获取表名,有列名,不知道表名的*/

select a.Name as tableName from sysobjects a inner join syscolumns b on a.ID=b.IDwhere b.Name='A1'

/*根据表名获取表的字段,类型和长度*/

select syscolumns.*, syscolumns.name as columns,systypes.name as columntype,syscolumns.length
    from syscolumns join systypes
   on syscolumns.xusertype=systypes.xusertype
where syscolumns.Id=object_id('tb_gw')

 

 

/*获取列是text类型,列的值为'' or is null 的sql*/

/**/

select datalength(columnsname)=0 or datalength(columnsname) is null

 

delete from TrialData where id in (
select id from TrialData where
1=1 and
NodeFileId=1731 and patientid=392 and  (datalength(data)=0 or datalength(data) is null))

阅读更多
文章标签: sql join null object
个人分类: mssql
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭