SQL Server using in keyword pass string array query

前端 未结 3 1087
日久生厌
日久生厌 2021-01-16 20:28

I don\'t think the IN clause can accept bind parameters with multiple values. Oracle can\'t and a couple minutes

and query is

declare @setting varch         


        
3条回答
  •  太阳男子
    2021-01-16 21:01

    You need to make Setting a table, not a varchar.
    Then there is no need for dynamic sql and you can keep it simple like this

    declare @Setting table (name varchar(50))
    
    insert into @Setting (name)
    values ('Sales Entry Grid Cursor'), 
           ('Customer Mandatory'),
           ('Column Uom'),
           ('Show Marka'),
           ('Show Discount Amount In Grid'),
           ('Show Discount % In Grid'),
           ('Calculation based on Weight *rate')
    
    Select pageconfig_action 
    from   [RetailSoft].[dbo].[tbl_pageconfig] 
    Where  [PageConfig_settingsName] in (select name from @setting)
    and    PageConfig_CompanyId=1
    

提交回复
热议问题