久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

從 csv 字符串進行 sql 搜索

sql search from csv string(從 csv 字符串進行 sql 搜索)
本文介紹了從 csv 字符串進行 sql 搜索的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在做一個搜索頁面,我必須用一個文本框搜索多個字段.所以我會在我的存儲過程中以 CSV 字符串的形式獲取搜索文本

im doing a search page where i have to search multiple fields with a single textbox. so i will get the search text as a CSV string in my stored procedure

我的表格如下

ID  Name          age   
5   bob           23    
6   bod.harry     34    
7   charles       44    

我需要一個類似這樣的 sql 查詢

i need a sql query something like this

declare @searchtext='bob,harry,charley'
select * from employee where  name like (@searchtext) 

此查詢應返回此記錄(id 5 和 6)

this query should return both this records (id 5 and 6)

推薦答案

你可以在存儲過程中使用這種方式,

You can use this way in Stored Procedure,

declare @searchtext varchar(1000)

set searchtext ='bob,harry,charley'

declare @filter varchar(2000)

set @filter = '(name LIKE ''%' + replace('bob,harry,charley',',','%'' OR name LIKE ''%') + '%'')'

exec
('
    select *
    from mytab
    where ' + @filter + '
'
)

這篇關于從 csv 字符串進行 sql 搜索的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創建視圖?)
Create calculated value based on calculated value inside previous row(根據前一行內的計算值創建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 天天操天天射综合 | 一区二区三区免费 | 国产美女精品 | 色综合久久久 | 日日碰狠狠躁久久躁婷婷 | 久久最新精品 | 国产免费一区 | 亚洲午夜网| 成人二区 | 免费成人高清 | 妖精视频一区二区三区 | 亚洲视频免费在线 | 性高湖久久久久久久久3小时 | www.日韩| 在线国产一区 | 国产在线观看网站 | 中国一级大黄大片 | 精品一区二区av | 日韩视频免费 | 这里只有精品99re | av大片在线观看 | 欧美一区二区精品 | 国产91成人 | 久久久一区二区 | 在线国产视频 | 在线免费观看色 | 日韩成人影院在线观看 | 超碰伊人 | 一级做a | 一区二区三区视频在线观看 | 国产欧美一区二区精品久导航 | 国产精品九九九 | 久久成人高清视频 | 毛片av免费看 | 国产精品日韩一区二区 | 欧美国产一区二区三区 | 亚洲精品一 | 黄在线免费观看 | 色爽女| 日韩一区二区在线视频 | 无码一区二区三区视频 |