sql中用LTRIM ( ),RTRIM ( )。分别截断首尾空格,返回字符表达式。
例1:
DECLARE @string_to_trim varchar(60)
SET @string_to_trim = ' Four spaces are after the period in this sentence. 'SELECT 'BEGIN|' + CHAR(13) + ltrim(rtrim(@string_to_trim))+'|END'詳見:
例2:@"Select ltrim(rtrim(ProbCd)) as ProbCd,ltrim(rtrim(Descript)) as Descript from bd_ProbCdwhere substring(ProbCd,1,2) = '" + strProbCls + "' order by ProbCd"