Split a string on sql -
i have string on 1 of columns on database table
black lines^tech43223
i need split string, , code split string
select ltrim(substring(complaint, charindex('^',complaint)+1, len(complaint))) service
and result is
tech43223
but need string "black lines". can split string, , first value?
you're close!! substring()
function works follows:
substring( value, start position, length)
start beginning of string, , trim @ occurrence of character:
select ltrim(substring(complaint, 1, charindex('^',complaint) ) service
test it, if result includes split character ^
may need subtract 1:
select ltrim(substring(complaint, 1, charindex('^',complaint)-1 ) service
Comments
Post a Comment