tsql - SQL Server T-SQL TRIM END -
i need trim ; string inside t-sql. if has it. below :
declare @_tags nvarchar(max); set @_tags = 'bla; bla;'; --select trimend(@_tags, ';'); so, if @_tags ends ;, ; trimmed. how can that?
to remove if last char ;:
select case when right(@_tags, 1) = ';' replace (@_tags, ';', '') else @_tags end to remove end 1 only:
select case when right(@_tags, 1) = ';' stuff(@_tags, len(@_tags), 1, '') else @_tags end
Comments
Post a Comment