Does SQL Server automatically trim nvarchar fields upon query?

前端 未结 3 1038
独厮守ぢ
独厮守ぢ 2021-01-18 19:08

I have this query :

select \'[\' + p.Firstname + \']\' from Person p
where p.Firstname = \'Johanne\'

In the table, I have multiple personn

3条回答
  •  广开言路
    2021-01-18 19:54

    I am not sure in EF but in TSQL I use DataLength

    DataLength

    DataLength will return the length including trailing blanks
    Len will return the the length not including the trailing blanks

    and DataLength(p.Firstname) = Len('Johanne')  
    

提交回复
热议问题