之前写了一个 生成txt的命令if exist "D:\a.txt" (sqlcmd -S"127.0.0.1" -U"sa" -P"123456" -d"**B" -Q"SELECT ROW_NUMBER () OVER (ORDER BY(SELECT 0)) AS rownum,t1.ID,t1.AtlasNo,t1.AtlasName,t2.AtlasIP,t2.VIN_Number,t2.Torque,t2.Angle,t2.Tightening_Status,t2.AddTime from tb_AtlasInfo t1 inner join Log_AtlasLastTighteningResultData t2 on t1.IP=t2.AtlasIP where t1.AtlasNo like '%%'and t1.AtlasName like '%%' and t2.VIN_Number like '%%'and (isnull('2018-05-01 00:00:00','')=''or t2.AddTime>='2018-05-01 00:00:00') and (isnull('2018-05-31 23:59:59','')=''or t2.AddTime<='2018-05-31 23:59:59') and isnull(t2.VIN_Number,'')!=''" -o "d:\a.txt") else (sqlcmd -S"127.0.0.1" -U"sa" -P"123456" -d"**B" -Q"SELECT top 10 ROW_NUMBER () OVER (ORDER BY(SELECT 0)) AS rownum,t1.ID,t1.AtlasNo,t1.AtlasName,t2.AtlasIP,t2.VIN_Number,t2.Torque,t2.Angle,t2.Tightening_Status,t2.AddTime from tb_AtlasInfo t1 inner join Log_AtlasLastTighteningResultData t2 on t1.IP=t2.AtlasIP where t1.AtlasNo like '%%'and t1.AtlasName like '%%' and t2.VIN_Number like '%%'and (isnull('2018-05-01 00:00:00','')=''or t2.AddTime>='2018-05-01 00:00:00') and (isnull('2018-05-31 23:59:59','')=''or t2.AddTime<='2018-05-31 23:59:59') and isnull(t2.VIN_Number,'')!=''" -o "d:\a.txt")
这个生成后
就这个样子 请各位帮忙