title: Getting 5 digit Zip Code from string Data
body: <p>I have a string that contains City,State Zip, and Country. I have been able to get the City and State from the string into a separate column but I ran into issues getting the zip code pulled out. Here is an example of the data I am pulling from. </p>
  
  <p>Columbus,OH 43219, United States </p>
  
  <p>The code I have tried is this </p>
  
  <pre><code>Replace(LTRIM(RTRIM(LEFT(C.[BILLING_CITYSTATEZIP], CHARINDEX(',', C.[BILLING_CITYSTATEZIP])))),',','')as City,
  
     left(LTRIM(RTRIM(SUBSTRING(C.[BILLING_CITYSTATEZIP], CHARINDEX(',', C.[BILLING_CITYSTATEZIP])+1, LEN(C.[BILLING_CITYSTATEZIP])-(CHARINDEX('', C.[BILLING_CITYSTATEZIP])-1)))),2)as State,
  
     dbo.udf_GetNumeric(Right(LTRIM(RTRIM(Substring(C.[BILLING_CITYSTATEZIP], CHARINDEX(',', C.[BILLING_CITYSTATEZIP])+1, LEN(C.[BILLING_CITYSTATEZIP])-(CHARINDEX('',C.[BILLING_CITYSTATEZIP]-1)))),2))as Zip,
  </code></pre>
  
  <p>I included the code I used to pull the City and State because I mirrored the line for the Zip code off of the State line but I keep getting the error below. I can't figure out where I am missing the argument for the ltrim. Any advice would be welcome. </p>
  
  <p>Msg 174, Level 15, State 1, Line 36
  The ltrim function requires 1 argument(s).
  Msg 102, Level 15, State 1, Line 52
  Incorrect syntax near ','.</p>