/// <summary> /// 公司分支的清空SQL /// </summary> /// <param name="data">表信息</param> /// <returns></returns> public string FormatBUSQL(ComparaResult data) { string projField = data.FieldList.SingleOrNew(e => e.FieldName.In("ProjGUID,ProjectGUID")).FieldName; string childSelect = "SELECT ProjGUID FROM p_Project WHERE BUGUID IN ('+ @chvBUList +')"; return(projField.IsEmpty() ? $@" -- {data.TableNameChn} EXEC ('DELETE FROM {data.TableName} WHERE 【'外键'】 IN ( SELECT 【'主键'】 FROM 【'主表'】 WHERE ProjGUID IN ({childSelect}))') ".Trim() : $@" -- {data.TableNameChn} EXEC ('DELETE FROM {data.TableName} WHERE {projField} IN ( {childSelect})')".Trim()); }
/// <summary> /// ALL分支的清空SQL /// </summary> /// <param name="data">表信息</param> /// <returns></returns> public string FormatAllSQL(ComparaResult data) { return(data.TableNameChn.IsEmpty() ? $"TRUNCATE TABLE {data.TableName}" : $"TRUNCATE TABLE {data.TableName} -- {data.TableNameChn}"); }