如何在sql server中搜索字符串 [英] how to search string in sql server

查看:76
本文介绍了如何在sql server中搜索字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



Dear all,

select CustomerName=FirstName+ ' ' + LastName from tbCustomer
and result is Ramesh kumar gupta
how to search :- Ramesh or kumar Or gupta
or Remesh kumar or Remesh gupta or Kumar or gupta or kumar gupta



如何在sql server中搜索全部我们在检索条件上面提到的条件。


how to search in sql server with all condition which we mentions above search condition.

推荐答案

select * from tblCustomer where CustomerName like 'R%' or CustomerName like 'k%' or CustomerName like 'g%'





尝试类似上面的内容,你最终会得到理想的结果..



希望它有所帮助..



regrds

anurag



try something like above and u will ultimately get the desired result..

hope it helps..

regrds
anurag


其中FirstName喜欢''%Ramesh%''或LastName喜欢'' %Ramesh%''

或FirstName喜欢''%Kumar%''











这假设您的数据库已创建为不区分大小写,并且您不知道当你搜索Ramesh时,真的想要包括Remesh
Where FirstName like ''%Ramesh%'' or LastName like ''%Ramesh%''
or FirstName like ''%Kumar%''


etc.


This assumes that your db has been created as case insensitive and that you don''t REALLY want to include Remesh when you search for Ramesh


试试这个..



i假设CustomerName是你输入的数据进入文本框。



Try this..

i assume CustomerName is whatever you enter the data into textbox.

select * from table_name where Customer_name like '%CustomerName%'


这篇关于如何在sql server中搜索字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆