sqlserver查詢一張表所有欄位是否含製表符、換行符、回車符

lusklusklusk發表於2016-09-26
製表符: 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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章