sqlserver查询一张表所有字段是否含制表符、换行符、回车符

制表符: CHAR(9)
换行符: CHAR(10)
回车符: CHAR(13)




select 'SELECT COUNT(*) FROM 表名 where CHARINDEX(CHAR(9),"'+SysColumns.name+'")>0 union all'
from sysobjects inner join SysColumns on sysobjects.id=SysColumns.id 
where sysobjects.name='表名'


select 'SELECT COUNT(*) FROM 表名 where CHARINDEX(CHAR(10),"'+SysColumns.name+'")>0 union all'
from sysobjects inner join SysColumns on sysobjects.id=SysColumns.id 
where sysobjects.name='表名'


select 'SELECT COUNT(*) FROM 表名 where CHARINDEX(CHAR(13),"'+SysColumns.name+'")>0 union all'
from sysobjects inner join SysColumns on sysobjects.id=SysColumns.id 
where sysobjects.name='表名'

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-2125598/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30126024/viewspace-2125598/

你可能感兴趣的:(数据库)