Question : Truncating "****" from the right hand side of a string

Suppose there is a string ''abcdefg****". How do I truncate the "****"?

I tried using REPLACE(@MyVar,'*','') but for some reason I'm left with the "a". The number of astrisks and the length of the string "abcdefg" might vary.

Answer : Truncating "****" from the right hand side of a string

This worked fine for me:

Declare @MyVar varchar(50)
Set @MyVar = 'F134654****'
select REPLACE(@MyVar,'*','')

Output:
F134654
Random Solutions  
 
programming4us programming4us