locked
in sql server RRS feed

  • General discussion

  • how to add multiple string values in a input parameter of sp?
    Friday, March 9, 2018 6:53 AM

All replies

  • Hi,

    It depends on amount of data you are going to pass to your input parameter.

    If multiple string values is not too long then you can send a comma separated value as an string type input parameter.

    Refer Link

    You can also create a data table of your multiple string values and send it as a table type input parameter.

    Refer Link

    Or else your can serialize your string in an XML format and send  it as an XML type input parameter

    Refer Link

    Please vote if you found it helpful

    Please mark it as answer if it resolved your issue

    Regards


    Sandeep Prajapati

    Friday, March 9, 2018 7:15 AM
  • There are multiple ways to pass multiple values to a SP parameter, like by passing CSV, XML, temp-table, TVP, JSON string, and inside SP parsing it and using in SQL Queries.

    Check here: https://sqlwithmanoj.com/2015/07/10/passing-multiple-values-with-a-single-parameter-in-a-stored-procedure-sql-server/

    Friday, March 9, 2018 7:37 AM