Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 grab last word

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2013-09-02 : 04:05:57
how can i only grab the last 4 ID:

data
19Jul hello ID UKAU
9Jul hello ID UJKO
7Jul hello ID POJP

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-09-02 : 04:59:50
[code]
select right('19Jul hello ID UKAU', charindex(' ' , reverse('19Jul hello ID UKAU')) - 1)[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-09-02 : 08:36:34
if its always 4 characters, why not just

RIGHT(data,4)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -