首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

排除不想要的字符,该怎么处理

2012-02-19 
排除不想要的字符我现在只想要0、1、2、3、4、5、6、7、8、9和小数点,其他的字符不要。SQL Server Business Intellig

排除不想要的字符
我现在只想要0、1、2、3、4、5、6、7、8、9和小数点,其他的字符不要。SQL Server Business Intelligence Development Studio可以做到吗?

[解决办法]

SQL code
declare @str varchar(100)declare @i intset @str = 'dfji2349234.sfk23rd'set @i = patindex('%[^1-9,^.]%',@str)while @i>0begin    set @str = stuff(@str,patindex('%[^1-9,^.]%',@str),1,'')    set @i = patindex('%[^1-9,^.]%',@str)endselect @str/************----------------------------------------------------------------2349234.23(1 行受影响) 

热点排行