sql ltrim rtrim

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'

詳見:http://blog.sina.com.cn/10l01

 

例2:@"Select ltrim(rtrim(ProbCd)) as ProbCd,ltrim(rtrim(Descript)) as Descript from bd_ProbCdwhere substring(ProbCd,1,2) = '" + strProbCls + "' order by ProbCd"

posted on 2021-11-16 16:06  hushzhang  阅读(54)  评论(0编辑  收藏  举报

导航