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.
Author |
Topic |
ryoka12
Starting Member
9 Posts |
Posted - 2015-01-19 : 04:15:37
|
Hi,
How can i extract string but ignore the last word. Example.
declare x varchar(max)='the quick brown fox jump over the lazy dog.'
i just want to ignore the word 'dog.'
Thanks and help much appreciated.
|
|
nagino
Yak Posting Veteran
75 Posts |
Posted - 2015-01-19 : 04:49:47
|
declare @x varchar(max)='the quick brown fox jump over the lazy dog.' select left(@x, len(@x) - charindex(' ', reverse(@x)) + 1)
------------------------------------- From Japan Sorry, my English ability is limited. |
 |
|
ryoka12
Starting Member
9 Posts |
Posted - 2015-01-19 : 06:30:26
|
@nagino It works perfectly. Thanks.. ^_^ |
 |
|
|
|
|