How to trim a string in SQL Server before 2017?

后端 未结 7 1593
心在旅途
心在旅途 2020-12-04 17:25

In SQL Server 2017, you can use this syntax, but not in earlier versions:

SELECT Name = TRIM(Name) FROM dbo.Customer;
7条回答
  •  佛祖请我去吃肉
    2020-12-04 17:43

    in sql server 2008 r2 with ssis expression we have the trim function .

    SQL Server Integration Services (SSIS) is a component of the Microsoft SQL Server database software that can be used to perform a broad range of data migration tasks.

    you can find the complete description on this link

    http://msdn.microsoft.com/en-us/library/ms139947.aspx

    but this function have some limitation in itself which are also mentioned by msdn on that page. but this is in sql server 2008 r2

    TRIM("   New York   ") .The return result is "New York".
    

提交回复
热议问题