Alternatives · Basic Logics · Data Analysis · Data Management · Real Scenario Logic's · String Manipulation

SuperTrim Function in SQL Server

After Reading my Article - To Remove Multiple and Duplicate Spaces to Single Space in SQL Server, I received the email where one of my friend is asking for the below requirements- To Remove Invisible TAB, Carriage Return, Line Feed characters, White Spaces, Non-Breaking Spaces etc., Leading and Trailing spaces need to remove.Further, contiguous occurrences… Continue reading SuperTrim Function in SQL Server

Advertisement
Alternatives · Basic Logics · Real Scenario Logic's · String Functions · String Manipulation

To Remove Multiple and Duplicate Spaces to Single Space in SQL Server

In this blog post, we would see some of the easy methods to remove Multiple as well as Duplicate Spaces to Single Space using T-SQL in SQL Server like below. METHOD 1 - WHILE LOOP AND REPLACE By Using WHILE Loop, we can check the occurrences of double spaces, as Loop Condition.Till the occurrence (Loop)… Continue reading To Remove Multiple and Duplicate Spaces to Single Space in SQL Server

String Functions

REPLACE Vs. STUFF

REPLACE To Replace all occurrences of the given pattern in a string. It Executes till it replaces all occurrences of the given pattern in a string.Syntax - REPLACE ( String_Expression , String_Pattern , String_Replacement ) Example - DECLARE @String_Expression VARCHAR(50)='Input:-)String:-)ForExample'; DECLARE @String_Pattern VARCHAR(10)=':-)'; DECLARE @String_Replacement VARCHAR(1)=''; SELECT @String_Expression AS INPUT_STRING, REPLACE ( @String_Expression, @String_Pattern, @String_Replacement… Continue reading REPLACE Vs. STUFF