Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
adiboy0420
Starting Member
10 Posts |
Posted - 2012-07-12 : 23:02:22
|
hello i need help...so i have a problem ... the input needs to be @x ='abc,1,2,0.5'( this can be any string put by user)and the results i need is abc120.5----------------------------------------------- so my codedeclare @x varchar(5000)declare @y varchar (2000)declare @z varchar(1000)set @x ='abc,1,2,0.5'set @y=@xwhile(CHARINDEX(',',@y)>0)begin set @z= LEFT(@y,charindex(',',@y)+1)select @zset @y= RIGHT(@y,len(@y)-len(@z)-1)endand results i get is abc12and missing the 0.5.. now if i put the comma at the end of set @x ='abc,1,2,0.5,' it will work.... but i need it the input to me set @x ='abc,1,2,0.5'...so how do i do this :( please help |
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2012-07-12 : 23:26:11
|
set @y=@x+',' |
 |
|
adiboy0420
Starting Member
10 Posts |
Posted - 2012-07-13 : 00:40:28
|
it worked thank you so much |
 |
|
|
|
|
|
|