I'm trying to turn my IP address into set of 3-digit numbers, left padded with 0. I can easily do that like so:
DECLARE @merged VARCHAR(15);
SELECT @marged = COALESCE(@merged + '.', '') + RIGHT('000' + [value], 3)
FROM string_split(ip_address, '.');
But now I want to do something like that within a broader select statement.
SELECT Name, @merged AS IP_Address, Mac_Address
FROM some_table
I'm not sure how to get the @merged
part there though when I'm querying against a full table.