将存储过程分配给FilterClause [英] Assigning a Stored Procedure to a FilterClause

查看:82
本文介绍了将存储过程分配给FilterClause的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的配置范围需要复杂的过滤器。目前,filterclause包含最多三个嵌套的选定语句,这些语句会极大地影响同​​步过程。是否可以在filterclause中分配存储过程 类似于: 

I have the need for a complex filter on my provisioning scope. Currently the filterclause contains up to three nested selected statements which is impacting the sync process greatly. Is it possible to assign a stored procedure in the filterclause similar to: 

-f

推荐答案

如果有人有兴趣吗?这是我提出的解决方案。使用表定义的函数而不是SP。

If anyone is interested? Here is the solution I came up with. Use a table defined function instead of a SP.

    string spDefinition =" Select ID FROM dbo.testFunction(@ID)" ;

    string spDefinition = "Select ID FROM dbo.testFunction(@ID)";

                eventScopeServerTemplate.Tables [" Products"]。AddFilterColumn(" ID");

                eventScopeServerTemplate.Tables [" Products"]。FilterClause =" [side]。[ID] IN(" + spDefinition +")" ;;
$


                SqlParameter param = new SqlParameter(" @@ ID",SqlDbType.Int);

                eventScopeServerTemplate.Tables [" Products"] .FilterParameters.Add(param);

                eventScopeServerTemplate.Tables["Products"].AddFilterColumn("ID");
                eventScopeServerTemplate.Tables["Products"].FilterClause = "[side].[ID] IN (" + spDefinition + ")";

                SqlParameter param = new SqlParameter("@ID", SqlDbType.Int);
                eventScopeServerTemplate.Tables["Products"].FilterParameters.Add(param);

-f


这篇关于将存储过程分配给FilterClause的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆