I need to only get the names from a String that looks something like:
I have a cat called Bob and a rabbit called John and a dog called Betty
Using SQL and getting each pet name into a separate column.
Edit
I've tried using:
substring(string, CHARINDEX('called', string) + 7, CHARINDEX('and', string, CHARINDEX('called', string)) - CHARINDEX('called', string - 7) as name
use find and subtring_index. if the syntax of the string is always same you can use substing_index only by splitting on spaces
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.