sql server 中 长数字隔三位用逗号","隔开怎么做
1个回答
展开全部
if object_id('tempdb.dbo.#tb') is not null drop table #tb
go
create table #tb (id int,price varchar(100),customer int,cinvcode int)
insert into #tb
select 1,'1.5',4,2 union all
select 2,'3.5,6',3,2 union all
select 3,'2.5,3',6,1 union all
select 4,'5',1,5
select id=row_number()over(order by getdate()),
customer,
cinvcode,
price=substring(price+',',number,charindex(',',price+',',number)-number)
from #tb ,master..spt_values s
where type='p' and number>0 and substring(','+price,number,1)=','
go
create table #tb (id int,price varchar(100),customer int,cinvcode int)
insert into #tb
select 1,'1.5',4,2 union all
select 2,'3.5,6',3,2 union all
select 3,'2.5,3',6,1 union all
select 4,'5',1,5
select id=row_number()over(order by getdate()),
customer,
cinvcode,
price=substring(price+',',number,charindex(',',price+',',number)-number)
from #tb ,master..spt_values s
where type='p' and number>0 and substring(','+price,number,1)=','
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询