Answers for "Select equation answer as number"
https://ask.sqlservercentral.com/questions/154511/select-equation-answer-as-number.html
The latest answers for the question "Select equation answer as number"Answer by Magnus Ahlkvist
https://ask.sqlservercentral.com/answers/154518/view.html
<p>If you always have one nominator and one denominator, than something like this could work.</p><pre>DECLARE @t TABLE(s VARCHAR(100));
INSERT @t (s)
VALUES
('150/5'),
('200/5');
WITH CTE AS(
SELECT
CAST(LEFT(s,CHARINDEX('/',s)-1) AS INT) AS first,
CAST(SUBSTRING(s,CHARINDEX('/',s)+1,LEN(s)) AS INT) AS second
FROM @t
)SELECT first,second,first/second FROM cte;
</pre><p>Guess there are more elegant ways of doing it, and this would break if there's not exactly one '/' in the column.</p>Tue, 28 Jan 2020 13:18:36 GMTMagnus Ahlkvist