I am using Parsename in SQL and would like to extract the last item in the list of items. I am using the following code.
Declare @string as varchar(1000) set @string = '25.26.27.28' SELECT PARSENAME(@string, 1)
This works and returns a value of 28, as I expect. However, if I expand my list of more than 4 elements, then the result returns NULL. For instance:
Declare @string2 as varchar(1000) set @string2 = '25.26.27.28.29' SELECT PARSENAME(@string2, 1)
I would expect this to return 29, however only NULL is returned
I am sure there is a simple explanation for this, who can help?
Philc source share