本文介绍了MS SQL中的空间是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(General_Brand +SPACE(1)+ General_Model LIKE @BrandModel)


我在to字段之间需要一个空格,但是它不起作用.

例如:当作者键入"Nokia"时,可以找到"Nokia 701";当他键入"701"时,可以找到"Nokia 701",但是当他键入"Nokia 70"时,它找不到任何提示,我该怎么办?
tnx寻求帮助.


i need one space between the to field but it does not work .

for example : when the writer type "Nokia" it can find "Nokia 701" and also when he type "701" it can find "Nokia 701" but when he type "Nokia 70" it does not find any think what can i do ?
tnx for helps.

推荐答案

select '>' + char(32) + '<'


但是,在数据库中串联字段通常被认为是不好的做法.考虑将品牌和模型划分到两个不同的字段(或适当的话甚至划分到两个不同的表)


However, having concatenated fields in the database is often considered as a bad practice. Consider separating the brand and the model to two different fields (or even to two different tables if appropriate)



(General_Brand +' '+ General_Model LIKE '%' + @BrandModel + '%')



它会找到与@BrandModel
类似的任何General_Brand +'' ''+ General_Model
希望对您有所帮助.



It finds any General_Brand +'' ''+ General_Model that is like @BrandModel

Hope it helps.


这篇关于MS SQL中的空间是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:39