Remove Spaces in columns in sql table
Remove Spaces in columns in sql table
CREATE FUNCTION dbo.TRIM(@string VARCHAR(MAX))
RETURNS VARCHAR(MAX)
BEGIN
RETURN LTRIM(RTRIM(@string))
END
GO
RETURNS VARCHAR(MAX)
BEGIN
RETURN LTRIM(RTRIM(@string))
END
GO
SELECT dbo.TRIM(' aaaaa strig ')or
UPDATE Table_name SET columnname= dbo.TRIM(columnname))orWITH trimmed AS (SELECT LTRIM(RTRIM(fld1)) as fld1, LTRIM(RTRIM(fld2)) as fld2 ....) SELECT...
You can use following query for removing white spaces from all the columnsUPDATE Table_nameSETcolumnname= REPLACE(columnname,' ',''),columnname1=
REPLACE(columnname1,' ','')
and so on for as many columns as you have.
Comments
Post a Comment