I have a Variable that contains dynamic string. I want to get the word that is equal to COATitle only.
DECLARE @String Varchar(250)
SET @String = 'COATitle = ''Hello'' AND Date = ''2018-10-09'' AND Name = ''Warner Bros'''
SELECT @String AS String
This string is being provided from front end so user can enter in different order as well. For example
SET @String = 'Date = ''2018-10-09'' AND COATitle = ''Hello Tonia'' AND Name = ''Warner Bros'''
SET @String = 'COATitle = ''Hello'' AND Name = ''Warner Bros'' Date = ''2018-10-09'' AND '
SET @String = 'COATitle = ''Hello World'' AND Date = ''2018-10-09'' AND Name = ''Warner Bros'''
SET @String = 'COATitle = ''Piece of Cake'' AND Date = ''2018-10-09'' AND Name = ''Tim Martin'''
Expected output for above mentioned Strings are:
1: Hello Tonia
2: Hello
3: Hello World
4: Piece of Cake
