排除不想要的字符

冬日 2011-07-30 06:22:13
我现在只想要0、1、2、3、4、5、6、7、8、9和小数点,其他的字符不要。SQL Server Business Intelligence Development Studio可以做到吗?
...全文
66 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
冬日 2011-08-02
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 acherat 的回复:]
SQL code

declare @str varchar(100)
declare @i int
set @str = 'dfji2349234.sfk23rd'
set @i = patindex('%[^1-9,^.]%',@str)

while @i>0
begin
set @str = stuff(@str,patindex('%[^1-9,^.]%',@s……
[/Quote]
虽然搞定了'dfji2349234.sfk23rd'这个,但是我的数据库一点进展都没有,眼见此贴沉了,重发帖去,此贴结
AcHerat 2011-08-01
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 acherat 的回复:]

SQL code

declare @str varchar(100)
declare @i int
set @str = 'dfji2349234.sfk23rd'
set @i = patindex('%[^1-9,^.]%',@str)

while @i>0
begin
set @str = stuff(@str,patindex('%[^1-9,^.]%',@str),1,'……
[/Quote]

看错,是BI。。。
AcHerat 2011-08-01
  • 打赏
  • 举报
回复

declare @str varchar(100)
declare @i int
set @str = 'dfji2349234.sfk23rd'
set @i = patindex('%[^1-9,^.]%',@str)

while @i>0
begin
set @str = stuff(@str,patindex('%[^1-9,^.]%',@str),1,'')
set @i = patindex('%[^1-9,^.]%',@str)
end

select @str

/************

----------------------------------------------------------------------------------------------------
2349234.23

(1 行受影响)

冬日 2011-08-01
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 chuanzhang5687 的回复:]
只有想不到的,没有做不到的。
[/Quote]
[Quote=引用 2 楼 qianjin036a 的回复:]
建一个字符串循环检查程序.
[/Quote]
老大,给个代码也好啊。这样回答我怎么给分?
冬日 2011-08-01
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 acherat 的回复:]
SQL code

declare @str varchar(100)
declare @i int
set @str = 'dfji2349234.sfk23rd'
set @i = patindex('%[^1-9,^.]%',@str)

while @i>0
begin
set @str = stuff(@str,patindex('%[^1-9,^.]%',@s……
[/Quote]

我怎么把一列数值带入进去
--小F-- 2011-08-01
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 dongrizhixue 的回复:]
引用 5 楼 acherat 的回复:
引用 4 楼 acherat 的回复:

SQL code

declare @str varchar(100)
declare @i int
set @str = 'dfji2349234.sfk23rd'
set @i = patindex('%[^1-9,^.]%',@str)

while @i>0
begin
set @st……
[/Quote]
测试数据啊 要不给出你的测试数据和所需要的结果
冬日 2011-08-01
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 acherat 的回复:]
引用 4 楼 acherat 的回复:

SQL code

declare @str varchar(100)
declare @i int
set @str = 'dfji2349234.sfk23rd'
set @i = patindex('%[^1-9,^.]%',@str)

while @i>0
begin
set @str = stuff(@str,patind……
[/Quote]
set @str = 'dfji2349234.sfk23rd' 这是一坨什么?
-晴天 2011-07-30
  • 打赏
  • 举报
回复
建一个字符串循环检查程序.
chuanzhang5687 2011-07-30
  • 打赏
  • 举报
回复
只有想不到的,没有做不到的。

590

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧