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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-06-01 : 06:09:35
|
How do I look for the last occurance of space and then get everything before it?example:@sql = 'brothers here there'should return 'brothers here'Thanks |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-06-01 : 06:24:14
|
solved it by using reverse function.Thanks anyway. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-01 : 11:38:43
|
cool...for others sake could you please post what your final solution was?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-06-01 : 12:14:36
|
used the reverse function and the charindex |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-01 : 12:29:56
|
can you post solution using sample data for others to understand------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-06-01 : 18:16:25
|
declare @data varchar(50) = 'this is a test'declare @pos int = CHARINDEX(' ', reverse(@data), 1)SELECT SUBSTRING(@data, 1, len(@data) - @pos) |
 |
|
|
|
|