How do I use a MySQL stored procedure from c# which sends a table as input to the store procedure? I have T-SQL working

前端 未结 1 1541
我在风中等你
我在风中等你 2021-01-15 06:10

In Transact-SQL I have the input parameter to the store procedure

@DataTable InputTabel READONLY,

And the \"InputTabel\" is defined as:

相关标签:
1条回答
  • 2021-01-15 06:41

    Unfortunately MySql didn't implement table-valued parameters, but alternatives do exist:

    • Using a temporary table which drops immediately after the connection closes but is visible to all queries coming via this connection. The only con is having to execute an additional query (or more) before the intended query, just to insert data into the temp table.
    • Using a delimited string ("str1,str2,str3") which significantly downgrades performance, especially when the string is very long.

    For more info about both methods: Create table variable in MySQL

    0 讨论(0)
提交回复
热议问题