Remove Leading Zeros and Spaces In SQL-SERVER

In this Blog, I will discuss about “How to remove Leading Zeros and Spaces from a value in SQL server”. I have written procedure for it . See the below code . CREATE PROCEDURE [dbo].[RmLeadZerosSpcs] (@String VARCHAR(500) )asBEGINDECLARE @output VARCHAR(100) = ”;DECLARE @prev CHAR(1) = ”;DECLARE @c CHAR(1) = ”;DECLARE @i int = 1;DECLARE @len int;DECLARE @len_zeros int =0;SET @len = len(@String);WHILE(@i <= @len) begin SET @c = SUBSTRING(@String, @i, 1); IF @c=’0′ or @c=’ ‘ BEGIN SET @len_zeros=len(@c)+@i SET @output = substring(@String,@len_zeros, @len); SET @i = @i + 1;…