May 29, 2015 at 1:48 pm
Using the data setup from Eirikur and the data I added, the following works. Not knowing the state of your data, however, I can't promise anything.
SELECT
sd.SystemID
,ca1.IP
,ca2.MAC
FROM
dbo.SystemsRE sd
CROSS APPLY (SELECT LEFT(sd.IpAddress, PATINDEX('%,%', sd.IpAddress) - 1)) ca1(IP)
CROSS APPLY (SELECT RIGHT(sd.IpAddress, LEN(sd.IpAddress) - PATINDEX('%,%', sd.IpAddress) - 1)) ca2(MAC)
WHERE
patindex('%,%', sd.IpAddress) > 0;
May 29, 2015 at 1:48 pm
TJT (5/29/2015)
Wow! Well done!Yes I found one entry missing a comma. I don't suppose you have a trick to handle this one?
Fix the data.
Viewing 2 posts - 31 through 32 (of 32 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy