sql server - How do I split an address string in T-SQL? -
I want to split a column into 4 columns based on the column. Example: 'City_name', 'state', 'zip' code, 'country' in column value:
I call it 4 different columns such as City_Name
, state
, zipcode
, country
.
How can I do this by using T-SQL?
Assuming that you always have 3 commas in that column, you can use the function #test>
Table # Test Creation (Colonel Curse (100) ) Insert Personnel (Colonel, ',', '.'), 4) Name of the city as the name (pattern (colonel, ',', '.'), 3) state, (Q Name (Colonel, ',', '.'), 2) In the form of a zipod, the name (replacements (colonel, ',', '.'), 1) #test as the country
Output
City_Name State Zipcode Country New York City NJ 10028 United States Es
Comments
Post a Comment