zoukankan      html  css  js  c++  java
  • SQL查询和替换含有回车,空格,TAB,等

    ---如下是查询语句
    --查询名称有退格键
    select * from t_bd_item_info  where charindex(char(8),item_name) > 0 
    go
    
    
    --查询名称有制表符tab 
    select * from t_bd_item_info  where charindex(char(9),item_name) > 0 
    go
    --查询名称有换行  
    select * from t_bd_item_info where charindex(char(10),item_name) > 0 
    go
    --查询名称有回车  
    select * from t_bd_item_info where charindex(char(13),item_name) > 0 
    go
    --查询名称的空格(前空格、后空格、所有空格)
    select * from t_bd_item_info where isnull(charindex(' ',item_name),0) > 0   
    go
    --查询名称的单引号 
    select * from t_bd_item_info where charindex(char(39),item_name) > 0 
    go
    --查询名称的双单引号 
    select * from t_bd_item_info where charindex(char(34),item_name) > 0 
    go
    
    
    
    
    --处理名称有退格键
    update t_bd_item_info set item_name = replace(item_name,char(8),'') 
    where charindex(char(9),item_name) > 0 
    go
    
    
    --处理名称有制表符tab 
    update t_bd_item_info set item_name = replace(item_name,char(9),'') 
    where charindex(char(9),item_name) > 0 
    go
    --处理名称有换行  
    update t_bd_item_info set item_name = replace(item_name,char(10),'') 
    where charindex(char(10),item_name) > 0 
    go
    --处理名称有回车  
    update t_bd_item_info set item_name = replace(item_name,char(13),'') 
    where charindex(char(13),item_name) > 0 
    go
    --处理名称的空格(前空格、后空格、所有空格)
    update t_bd_item_info set item_name = replace(rtrim(ltrim(item_name)),' ','')  
    where isnull(charindex(' ',item_name),0) > 0   
    go
    --处理名称的单引号 
    update t_bd_item_info set item_name = replace(item_name,char(39),'') 
    where charindex(char(39),item_name) > 0 
    go
    --处理名称的双单引号 
    update t_bd_item_info set item_name = replace(item_name,char(34),'') 
    where charindex(char(34),item_name) > 0 
    go
  • 相关阅读:
    C# WPF定时器
    C#处理JSON数据
    SQL-乐观锁,悲观锁之于并发
    C# 集合-并发处理-锁OR线程
    C# 生成二维码,彩色二维码,带有Logo的二维码及普通条形码
    C# (事件触发)回调函数,完美处理各类疑难杂症!
    C# Lambda表达式
    C# 匿名方法
    浅谈C# 匿名变量
    鸡兔同笼
  • 原文地址:https://www.cnblogs.com/qq52117354/p/7743820.html
Copyright © 2011-2022 走看看