Skip to content
Advertisement

How to parse apt no from the address field in SQL [closed]

I NEED TO EXTRACT LAST NUMBER IN THE DATA AS APTNO?

[enter image description here][1]

My data in the below picture. I m almost there to get my results but i want the number and also when there is APt i want number with APT as well

Advertisement

Answer

One more method based on JSON.

It will work starting from SQL Server 2016 onwards.

SQL Server 2016

SQL Server 2008 onwards

XML/XQuery based method. Useful when number of tokens fluctuates (or unknown) for each row.

Output

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement