I am developing and implementing SBO.
In projects, you often need to adjust the standard system. For example, we only know a value, but we do not know which table the field exists. SBO has more than 930 tables, and each table generally has 100 to 200 fields. manual search is almost impossible.
As a result, I made a SQL full database check tool. You only need to enter the value you want to find, and then you can automatically find the table and field containing this value for you. This is very helpful for analyzing the execution of business logic. We recommend that you use it.
ProgramThe running interface is shown in the following figure:
It is very easy to use. You only need to enter the database service instance name, database user, database password, and click log on. All databases on the server will be automatically listed. Select a database and enter the value to be searched in the free text to start.
If fuzzy match is required, you only need to mark the hooks under the free text.
Working principle:
The working principle is very simple. It is to first find all the tables and construct an SQL statement based on the fields in the table. The number of statements is the product of data tables and fields.
Then, all the statements are executed one by one, and the retrieved results are listed in the middle datagridview. The result contains the SQL statement that finds the value.
Because datatable is used before, the efficiency is very low. to search for more than 900 tables, each table has about 150 fields, and it is estimated that it will be calculated 135000*2 times. There was no progress after ten minutes. Later, we switched to datareader, which greatly improved the efficiency! It takes about five minutes for my machine to calculate this amount. For databases with few data tables, this can be done within one minute.
My machine Configuration:
Lenovo thickpad t60.
CPU: t5500
Mem: 2G
If it is convenient for friends, you are welcome to use it.
If you need source code, contact me.
Email: guofumail@163.com
QQ: 42319036
Source code: http://files.cnblogs.com/saptechnique/SqlFullQuerys_Sourcecode.rar
Executable program: http://files.cnblogs.com/saptechnique/SqlFullQuerys.rar