TSQL how to remove all characters or text after the last tab space -


I have some data that looks like this:

  Maple Leaf City   

This is in a single column called City.

I want to remove the word city so that the output looks like this:

  maple << code>   

The code removes everything after the first place rather than the last place.

How do I do this: Maple Leaf City and change it to Maple Leaf

What is:

  SELECT LEFT (city, CHARINDEX ('', city) - 1) Where the Chardix ('', city) & gt; 1   

My code gives me this: Maple

  declare @ root varchar (255) set @tr = 'maple leaf city' LEFT (@str, ln (@rr) - charxx ('', river (@rrt)) < / Code>   

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -