diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs index f83a2c8a0..f06d91048 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs @@ -478,11 +478,15 @@ namespace SqlSugar } public string GetSqlQuerySql(string result) { + var old = result; if (this.IsSqlQuery && (Skip == null && Take == null)) { result = System.Text.RegularExpressions.Regex.Match(result, @"^SELECT .* FROM \(((.|\n|\r)*)\) t $").Groups[1].Value; } - + if (string.IsNullOrEmpty(result)) + { + result = old; + } return result; } #endregion