将存储过程分配给FilterClause [英] Assigning a Stored Procedure to a 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屋!