简体   繁体   English

数据挖掘/检索问题

[英]Data Mining/Retrieval Question

Our SQL Server 2005 database has nearly 100 different tables. 我们的SQL Server 2005数据库有近100个不同的表。 We are going to provide a feature to search some information according to the user defined filters. 我们将根据用户定义的过滤器提供搜索某些信息的功能。 Our filter configuration going to be quite complicated. 我们的过滤器配置非常复杂。 A user can easily create a filter that joins over 20 tables with complicated conditions. 用户可以轻松创建一个连接超过20个具有复杂条件的表的过滤器。

In order to reduce the complexity of the joining, we are planning to create couple of SQL Server views. 为了降低加入的复杂性,我们计划创建几个SQL Server视图。 But that solution itself doesn't seems to be enough to simplify the SQL. 但该解决方案本身似乎不足以简化SQL。 We are going to generate the SQL according to the filter configuration. 我们将根据过滤器配置生成SQL。 The SQL will be generated dynamically. SQL将动态生成。 (I am not sure how long that SQL would be… Is there any maximum length for SqlCommand?) SP is another option... (我不确定SQL会持续多长时间...... SqlCommand是否有最大长度?)SP是另一种选择......

Have you come across a similar situation? 你遇到过类似的情况吗? Do you have any good advise/solution for me? 你有什么好的建议/解决方案吗?

Thank you! 谢谢!

I would suggest creating a reporting database that de-normalizes your data, so you don't need the complicated queries. 我建议创建一个报告数据库,对数据进行去规范化,这样就不需要复杂的查询了。 Also make sure that any queries are parameterized to avoid sql injection attacks. 还要确保参数化任何查询以避免sql注入攻击。

Hope this helps. 希望这可以帮助。

您应该阅读动态SQL的诅咒和祝福,以了解一些陷阱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM