I have only 1 column in my table, in this table there are inputs like 990x70, 980x50. I need the values left and right of the 'x' to calculate inches of these 2 values. With this code I take only last registered entry from database. How can I get all entries? (Note: I have to use variables in this project.)
declare @Value1 numeric(18,1)
declare @Value2 numeric(18,1)
select
@Value2 = SUBSTRING(
[Values],
CHARINDEX('x', [Values]) + 1,
LEN([Values])) ,
@Value1 = SUBSTRING(
[Values],
1,
CHARINDEX('x', [Values]) - 1)
from myTable
select @Value1=@Value1/(2.54)
select @Value2=@Value2/(2.54)
select @Value1,@Value2 from myTable
Edit: There are 4 different sizes in my table and I get the same result 4 times. I want to get all results not only 1.