This is the data I have, it's separated by carriage returns.
'AM 1492 AM 1791 PM 1492 PM 1791 '
Desired results:
How do I get each piece of data on its own row? I've tried CharIndex to identify the character and I was thinking of using a substring, but I'm not sure how to separate each item into a row when there are multiple instances of a string like 'AM', 'AM', etc.
CREATE TABLE #T1
(
StringInfo VARCHAR (500)
)
INSERT INTO #T1 (StringInfo)
VALUES ('AM 1492 AM 1791 PM 1492 PM 1791 ')
SELECT *
FROM #T1 AS T

CROSS APPLY STRING_SPLIT(REPLACE(T.StringInfo, ' ', '|'), '|')should do the trick