设为首页 加入收藏

TOP

sybase的SQL去掉字段中数据的空格(前空格、后空格、所有空格)
2014-11-23 19:16:07 来源: 作者: 【 】 浏览:35
Tags:sybase SQL 去掉 段中 数据 空格 所有
sybase的SQL去掉字段中数据的空格(前空格、后空格、所有空格)
摘要:我们在使用sybase 数据库的时候经常会遇到字段中出现不同位置的空格,如字段值前空格“ sdfsd”,字段值中间出现空格“sdfsdf dsfsd”,字段值后面出现空格“sfsdfs”,当我们遇到这样的问题,我们怎么快速的去除所有的空格;
1、查询结果去掉左空格
select ltrim(字段) from xxxx where id=278
2、查询结果去掉右空格
select rtrim(字段) from xxxx where id=278
3、查询结果去掉所有的空格
select str_replace(字段,' ',null) from xxxx where id=278
4、更新到sybase数据库去掉左空格
update xxxx set 字段=(
select ltrim(字段) from xxxx where id=278
) where id=278
5、更新到sybase数据库去掉右空格
update xxxx set 字段=(
select rtrim(字段) from xxxx where id=278
) where id=278
6、更新到sybase数据库去掉所有的空格
update xxxx set 字段=(
select str_replace(字段,' ',null) from xxxx where id=278
) where id=278
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇sybase数据库导入导出 下一篇Sybase常见日期函数使用说明

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: