September 1, 2008 at 11:38 pm
I have created a table..fileds like
fld_category fld_amount
a+b+c 10+10+10
fld_category and fld_amount ,values is inserted from .net application. Now i need to extract values from fld_amount like '10' at a time..substring command might not work coz the values may vary. I need query in sql I am creating report using oledb.. Its very urgent please help
September 2, 2008 at 3:10 am
What about the separator between the values...?
September 2, 2008 at 3:18 am
How about this code...
Declare @a varchar(10)
Set @a = '100+101+12'
while @a <> ''
begin
if charIndex('+',@a) > 0
begin
Select SubString(@a,0,charIndex('+',@a))
Set @a = SubString(@a,charIndex('+',@a)+1,Len(@a))
end
else
begin
Select @a
Set @a = ''
end
end
use Your Field name against @a variable
Atif Sheikh
September 2, 2008 at 3:18 am
so how to write query to extract the values ??
September 2, 2008 at 3:30 am
thanks a lot it really did help
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply