<i id='zW3oz'><tr id='zW3oz'><dt id='zW3oz'><q id='zW3oz'><span id='zW3oz'><b id='zW3oz'><form id='zW3oz'><ins id='zW3oz'></ins><ul id='zW3oz'></ul><sub id='zW3oz'></sub></form><legend id='zW3oz'></legend><bdo id='zW3oz'><pre id='zW3oz'><center id='zW3oz'></center></pre></bdo></b><th id='zW3oz'></th></span></q></dt></tr></i><div id='zW3oz'><tfoot id='zW3oz'></tfoot><dl id='zW3oz'><fieldset id='zW3oz'></fieldset></dl></div>

  • <legend id='zW3oz'><style id='zW3oz'><dir id='zW3oz'><q id='zW3oz'></q></dir></style></legend>

    <tfoot id='zW3oz'></tfoot>

    <small id='zW3oz'></small><noframes id='zW3oz'>

    • <bdo id='zW3oz'></bdo><ul id='zW3oz'></ul>

        存储过程和实体框架 4.0 中的表值参数

        Table-Valued Parameter in Stored Procedure and the Entity Framework 4.0(存储过程和实体框架 4.0 中的表值参数)

        <legend id='gEjmC'><style id='gEjmC'><dir id='gEjmC'><q id='gEjmC'></q></dir></style></legend>
        • <bdo id='gEjmC'></bdo><ul id='gEjmC'></ul>
        • <small id='gEjmC'></small><noframes id='gEjmC'>

          <tfoot id='gEjmC'></tfoot>
        • <i id='gEjmC'><tr id='gEjmC'><dt id='gEjmC'><q id='gEjmC'><span id='gEjmC'><b id='gEjmC'><form id='gEjmC'><ins id='gEjmC'></ins><ul id='gEjmC'></ul><sub id='gEjmC'></sub></form><legend id='gEjmC'></legend><bdo id='gEjmC'><pre id='gEjmC'><center id='gEjmC'></center></pre></bdo></b><th id='gEjmC'></th></span></q></dt></tr></i><div id='gEjmC'><tfoot id='gEjmC'></tfoot><dl id='gEjmC'><fieldset id='gEjmC'></fieldset></dl></div>

                    <tbody id='gEjmC'></tbody>
                  本文介绍了存储过程和实体框架 4.0 中的表值参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 SQL Server 2008 中有一个名为GetPrices"的存储过程,带有一个名为StoreIDs"的表值参数.

                  I have a stored procedure in SQL Server 2008 called 'GetPrices' with a Table-Valued Parameter called 'StoreIDs'.

                  这是我为此 TVP 创建的类型:

                  This is the type i created for this TVP:

                  CREATE TYPE integer_list_tbltype AS TABLE (n int)
                  

                  我想从我的实体框架调用 SP.但是当我尝试将存储过程添加到 EDM 时,出现以下错误:

                  I would like to call the SP from my Entity Framework. But when I try to add the Stored Procedure to the EDM, i get the following error:

                  函数GetPrices"在参数索引 2 处有一个参数StoreIDs",该参数具有不受支持的数据类型表类型".该函数已被排除.

                  The function 'GetPrices' has a parameter 'StoreIDs' at parameter index 2 that has a data type 'table type' which is not supported. The function was excluded.

                  有什么解决办法吗?有什么想法吗?

                  Is there any workaround this? Any thoughts?

                  法比奥

                  推荐答案

                  我同意在这种情况下传递 CSV 刺是最好的解决方案.我想提出一种更简单的方法来拆分 csv 字符串,而无需使用 CTE 创建表和函数:

                  I agree that passing in a CSV sting is the best solution in this case. I would like to propose simpler way to split csv string, without creating tables and functions, by using CTE:

                  declare @separator char(1);
                  set @separator = ',';
                  
                  ;with baseCte as
                  (select left(@ValueList, charindex(@separator, @ValueList) - 1) as Value,
                  substring(@ValueList, charindex(@separator, @ValueList) + 1, len(@ValueList)) 
                  as rest
                  union all
                  select left(rest, charindex(@separator, rest) - 1) as Value, 
                  substring(rest, charindex(@separator, rest) + 1, len(rest)) from baseCte
                  where len(rest) > 1
                  )
                  select Value from baseCte
                  OPTION (MAXRECURSION 0);
                  

                  这篇关于存储过程和实体框架 4.0 中的表值参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Accessing another user#39;s table within an Oracle Stored Procedure(在 Oracle 存储过程中访问另一个用户的表)
                  Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)(超出最大存储过程、函数、触发器或视图嵌套级别(限制 32))
                  How to View Oracle Stored Procedure using SQLPlus?(如何使用 SQLPlus 查看 Oracle 存储过程?)
                  How to debug stored procedure in VS 2015?(如何在 VS 2015 中调试存储过程?)
                  How to Pass Java List of Objects to Oracle Stored Procedure Using MyBatis?(如何使用 MyBatis 将 Java 对象列表传递给 Oracle 存储过程?)
                  Set the variable result, from query(设置变量结果,来自查询)
                  <i id='tBSFq'><tr id='tBSFq'><dt id='tBSFq'><q id='tBSFq'><span id='tBSFq'><b id='tBSFq'><form id='tBSFq'><ins id='tBSFq'></ins><ul id='tBSFq'></ul><sub id='tBSFq'></sub></form><legend id='tBSFq'></legend><bdo id='tBSFq'><pre id='tBSFq'><center id='tBSFq'></center></pre></bdo></b><th id='tBSFq'></th></span></q></dt></tr></i><div id='tBSFq'><tfoot id='tBSFq'></tfoot><dl id='tBSFq'><fieldset id='tBSFq'></fieldset></dl></div>

                    <small id='tBSFq'></small><noframes id='tBSFq'>

                      <legend id='tBSFq'><style id='tBSFq'><dir id='tBSFq'><q id='tBSFq'></q></dir></style></legend>
                        <bdo id='tBSFq'></bdo><ul id='tBSFq'></ul>

                        1. <tfoot id='tBSFq'></tfoot>
                            <tbody id='tBSFq'></tbody>