Dear all,
Declare @key varchar(100)
Set @key = 'Total Price including Commission at This Level: '
Select
SUBSTRING(calculation,start,finish-start)
From
(
Select
calculation,
start = charindex(@key,calculation,1)+LEN(@key)+1,
finish = charindex(' ',calculation,charindex(@key,calculation,1)+LEN(@key)+1)
From pr_cal
) A
Result:
It returns few rows for eg:
-3.6847058823529411764705882353<br
-7.4565766786786564342346795345<br
-3.6842684690456865422468005352<br
and then i got "Invalid length parameter passed to the LEFT or SUBSTRING function" error
Please any one can let me know, How to amend this Query to avoid the above error and i need only value for ex -3.684.Thanks.
Regards,
SG
Declare @key varchar(100)
Set @key = 'Total Price including Commission at This Level: '
Select
SUBSTRING(calculation,start,finish-start)
From
(
Select
calculation,
start = charindex(@key,calculation,1)+LEN(@key)+1,
finish = charindex(' ',calculation,charindex(@key,calculation,1)+LEN(@key)+1)
From pr_cal
) A
Result:
It returns few rows for eg:
-3.6847058823529411764705882353<br
-7.4565766786786564342346795345<br
-3.6842684690456865422468005352<br
and then i got "Invalid length parameter passed to the LEFT or SUBSTRING function" error
Please any one can let me know, How to amend this Query to avoid the above error and i need only value for ex -3.684.Thanks.
Regards,
SG