Casting issues in SQL server -


i have column name capacity_band3 value follows '0.8617 x soq ^ -0.2155' string. trying extract first , last bit in example 0.8617 using

 cast(substring(capacity_band3,1,7) numeric)) 

but conversion fails

i trying cast numeric value can calculation, doing wrong?

i need last bit

cast(substring(capacity_band3,16,22)as numeric)) 

thank you

use left , right function extract number

select left(columnname,6),right(columnname,6) 

then apply cast operation

select cast(left(columnname,6) decimal(18,2)),cast(right(columnname,6) decimal(18,2)) 

Comments