巧妙的將陣列Join後的字串作為查詢條件

2021-06-02 19:06:53 字數 517 閱讀 3371

declare  @str  varchar(500)  

set @str='1,2,3,4,5,6,7'

create table #temp (id int)

declare @aaa varchar(8000)

set @aaa='insert #temp select * from (select '''+replace(@str,',',''' as str union all select ''')+''') a'

exec(@aaa)

現在要得到這樣乙個結果集,將表.classid在@str裡出現過(@str是外界傳過來的乙個引數)的記錄找出來,請問我該怎麼做?  

select  *  from  你的表  where  exists  (select  1  from  #temp  where  你的表.classid = #temp.id  )

巧妙的字串排序

sort str.c 讀入字串,並排序字串 include include define size 81 限制字串長度,包括 0 define lim 20 可讀入的最多行數 define halt 空字串停止輸入 void stsrt char string int num 字串排序函式 char...

Python 字串的join方法

通常,我們拿到乙個字串後,需要對字串進行處理加工,也就是說資料的清洗後,我們才可以使用,常用的字串操作廣泛應用在網路爬蟲以及web應用開發中,以及伺服器運維等方方面面。比如,爬蟲需要使用re也就是正規表示式對字串進行處理,提高我們爬蟲的效率,在運維方面,我們需要通過對日誌系統裡的字串提取出我們需要的...

split 將字串分割成字串陣列

list name list name.split split 方法用於把乙個字串分割成字串陣列。stringobject.split separator,howmany 引數 描述separator 必需。字串或正規表示式,從該引數指定的地方分割 stringobject。howmany 可選。該...