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 |
lcsgeek
Starting Member
38 Posts |
Posted - 2012-06-29 : 08:59:55
|
@endPercentile is a string that occasionally has a leading less-than or greater-than sign which I'm trying to strip. This code doesn't seem to be working. Can anyone give me some pointers? Thanks much. IF (LEFT(@endPercentile, 1) = '<' OR LEFT(@endPercentile, 1) = '>') BEGIN SET @endPercentile = RIGHT(@endPercentile, LEN(@endPercentile)-1) END |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-06-29 : 09:15:51
|
declare @test varchar(255)set @test = '<bla'if left(@test,1) in ('<','>')beginstuff (@test,1,1,'')end No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-29 : 22:46:45
|
SET @endPercentile = STUFF(@endPercentile,1,CASE WHEN @endPercentile LIKE '<%' OR @endPercentile LIKE '>%' THEN 1 ELSE 0 END, '')------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-06-30 : 16:10:36
|
set @endPercentile = replace(left(replace(left(@endPercentile,1),'<','>'),1),'>','') No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|