I have a query that returns the following columns:
Col1 contains a comma-delimited list of values, e.g., "27664,34874,43409,49887".
How do I extract and return the value of the first item from the list (Col1)? For example, 27664.
NOTE: Not all rows return a list of values in Col3. In other words, certain rows may return only one value, e.g., 12345; some may return NULL. I've tried to use a combination of CHARINDEX searching for "," and SUBSTRING() but have been getting an error.
Please provide SQL statement.
Thanks a lot.