我有很多.sql文件有很多空行,例如
WITH cteTotalSales (SalesPersonID,NetSales) AS ( SELECT SalesPersonID,ROUND(SUM(SubTotal),2) FROM Sales.SalesOrderHeader WHERE SalesPersonID IS NOT NULL GROUP BY SalesPersonID ) SELECT sp.FirstName + ' ' + sp.LastName AS FullName,sp.City + ',' + StateProvinceName AS Location,ts.NetSales FROM Sales.vSalesPerson AS sp INNER JOIN cteTotalSales AS ts ON sp.BusinessEntityID = ts.SalesPersonID ORDER BY ts.NetSales DESC
有没有办法在sql Server Management Studio中删除这些空行?这是我想要的:
WITH cteTotalSales (SalesPersonID,NetSales) AS ( SELECT SalesPersonID,2) FROM Sales.SalesOrderHeader WHERE SalesPersonID IS NOT NULL GROUP BY SalesPersonID ) SELECT sp.FirstName + ' ' + sp.LastName AS FullName,ts.NetSales FROM Sales.vSalesPerson AS sp INNER JOIN cteTotalSales AS ts ON sp.BusinessEntityID = ts.SalesPersonID ORDER BY ts.NetSales DESC
解决方法
没有内置,找到和替换可以与正则表达式一起使用,某些人可能会有一个解决方案.