I've got a column 'Title' and it holds values similar to this text here
HotelBeds SLU: Refugi Dels Isards Hotel in Pas de la Casa, Andorra (4 nights)
I'd want to select anything that comes after the colon (:) and exclude anything after the comma.
I tried this:
Select SUBSTRING(title,
CHARINDEX(':',title)+1,
CHARINDEX(',',title)
-CHARINDEX(':',title)-1) HotelName from booking_tbl
I see this error
Invalid length parameter passed to the LEFT or SUBSTRING function.
What am I doing wrong?
sub-stringare wrong. Select thecharindexvalues without using thesub-stringand you'll soon work out what you are doing wrong.