SQL Server using wildcard within IN

前端 未结 13 781
终归单人心
终归单人心 2020-12-02 20:07

Since I believe this should be a basic question I know this question has probably been asked, but I am unable to find it. I\'m probably about to earn my Peer Pressure badge,

13条回答
  •  情深已故
    2020-12-02 20:50

    How about something like this?

    declare @search table
    (
        searchString varchar(10)
    )
    
    -- add whatever criteria you want...
    insert into @search select '0711%' union select '0712%'
    
    select j.*
    from jobdetails j
        join @search s on j.job_no like s.searchString
    

提交回复
热议问题