用于验证SQL Server数据库架构的工具

时间:2022-02-01 12:45:08

Are there any tools available for validating a database schema against a set of design rules, naming conventions, etc.

是否有任何工具可用于根据一组设计规则,命名约定等验证数据库模式。

I'm not talking about comparing one database to another (as covered by this question).

我不是在谈论将一个数据库与另一个数据库进行比较(如本问题所述)。

I want to be able to say "What in this database doesn't meet this set of rules".

我希望能够说“这个数据库中的内容不符合这套规则”。

Some examples of the type of rules I'm talking about would be like:
- Primary key fields should be the first in the table.
- Foreign keys should have an index on that field.
- Field names ending 'xxx' should be of a certain type.
- Fields with a constraint limiting it it certain values it should have a default.

我正在讨论的规则类型的一些示例如下: - 主键字段应该是表中的第一个。 - 外键应该在该字段上有索引。 - 以“xxx”结尾的字段名称应为特定类型。 - 具有约束的字段限制它应具有默认值的特定值。

I've written a bunch of scripts to do this in the past and was wondering if there was something generic available.

我过去写了一堆脚本来做这件事,并且想知道是否有通用的东西可用。

Ideally I'd like something for SQL Server, but if you're aware of something for other databases it may be useful to know about them too.

理想情况下,我想要一些适用于SQL Server的东西,但是如果您知道其他数据库的某些内容,那么了解它们可能也很有用。

2 个解决方案

#1


1  

One way to accomplish this would be to script out an entire database and then apply rules consisting of regular expressions to the script. SSW's commercial tool does something similiar for SQL Server.

实现此目的的一种方法是编写整个数据库的脚本,然后将包含正则表达式的规则应用于脚本。 SSW的商业工具与SQL Server类似。

#2


1  

A tool called SQLCop is doing what your asking for, but I don't believe it actually allows you to write rules yourself.

一个名为SQLCop的工具正在做你想要的,但我不相信它实际上允许你自己编写规则。

http://sqlcop.lessthandot.com/detectedissues.php

http://sqlcop.lessthandot.com/detectedissues.php

#1


1  

One way to accomplish this would be to script out an entire database and then apply rules consisting of regular expressions to the script. SSW's commercial tool does something similiar for SQL Server.

实现此目的的一种方法是编写整个数据库的脚本,然后将包含正则表达式的规则应用于脚本。 SSW的商业工具与SQL Server类似。

#2


1  

A tool called SQLCop is doing what your asking for, but I don't believe it actually allows you to write rules yourself.

一个名为SQLCop的工具正在做你想要的,但我不相信它实际上允许你自己编写规则。

http://sqlcop.lessthandot.com/detectedissues.php

http://sqlcop.lessthandot.com/detectedissues.php