I use Microsoft SQL Server 2016.
I have a column that is called Failover
and looks like his:
$D$Failov:12345:54362:28564
$D$Failov:12345:
$D$Failov:86905:45634
I want that number so I use :
select substring(failover, 10, 5)
from dbo.f009
where failover like '$D$Failov:%'
It works fine, but if I want a second column called Account
, it crashed with multiple results…
Select
account,
(Select substring(failover, 10, 5) AS "1.Result"
from dbo.f009
where Failover like '$D$Failov:%')
from
f009
where
Failover like '$D$Failov:%'
How to fix this ?
Is there a simple way to take the second number and third? I can do it with:
substring(failover, 16, 5), substring(failover, 22, 5)
etc etc but it don't want to repeat myself.