SQL Server (2008) Pass ArrayList or String to SP for IN()

前端 未结 2 1089
难免孤独
难免孤独 2020-12-12 02:23

I was wondering how I can pass either an ArrayList, List> or StringBuilder comma delimited list to a stored procedure such that I find a list of IDs usin

2条回答
  •  爱一瞬间的悲伤
    2020-12-12 03:06

    In SQL 2008 there are table-valued-parameters, that make a friendly alternative to parsing CSV; see here for an example.

    Otherwise, another option is xml - the xml data type in SQL Server allows you to read this pretty easily (although it takes more transfer bytes).

提交回复
热议问题