# sql执行工具 **Repository Path**: zzf_1/sqltool ## Basic Information - **Project Name**: sql执行工具 - **Description**: 用于解决高版本sqlserver还原数据到低版本sqlserver,通过将原数据库中的数据保存为sql,按表保存到不同文件。这个工具用于还原,已经处理过因文件过大oom的问题,可以直接使用。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-31 - **Last Updated**: 2025-12-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SQL File Executor This application executes all .sql files in a specified folder against a SQL Server database. ## Features - Reads all .sql files from a specified folder - Executes SQL files sequentially - Handles GO statements properly by executing batches separately - Processes large files efficiently (line-by-line to avoid memory issues) - Provides progress feedback during execution - Copies failed SQL files to a designated folder - Shows execution summary with success/failure counts ## Usage 1. Run the application: `dotnet run` 2. Enter the database connection string when prompted 3. Enter the folder path containing .sql files 4. Enter the folder path where failed SQL files should be copied ## Performance Optimizations - Reuses database connections for all batches within a file (instead of opening/closing for each batch) - Processes large files line-by-line to avoid memory issues - Provides progress feedback every 10 batches - Increased timeout to 10 minutes for large operations ## Requirements - .NET 6.0 or later - SQL Server database access - System.Data.SqlClient NuGet package (included in project) ## Notes - The application handles GO statements as batch separators - Each batch within a file is executed separately - Failed files are copied to the designated failed files folder with the same name - Execution progress is shown with dots (.) for every 10 batches processed