From cc8c554a55c2a6250b4d9f1b992eea8bbc4fa685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Thu, 23 Apr 2020 21:00:41 +0200 Subject: [PATCH] Spread strings longer than allowed over multiple lines --- .../test.php | 4 +++- .../test.php | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/samples/tutorials/php/1.0 PHP Configuration and Getting Started/test.php b/samples/tutorials/php/1.0 PHP Configuration and Getting Started/test.php index f8ac75d0..34f6003e 100644 --- a/samples/tutorials/php/1.0 PHP Configuration and Getting Started/test.php +++ b/samples/tutorials/php/1.0 PHP Configuration and Getting Started/test.php @@ -32,7 +32,9 @@ while ($row = sqlsrv_fetch_array($getProducts, SQLSRV_FETCH_ASSOC)) { sqlsrv_free_stmt($getProducts); -$tsql = "INSERT SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate) OUTPUT INSERTED.ProductID VALUES ('SQL Server 15', 'SQL Server 12', 0, 0, getdate())"; +$tsql = "INSERT SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate) +OUTPUT INSERTED.ProductID +VALUES ('SQL Server 15', 'SQL Server 12', 0, 0, getdate());"; $insertReview = sqlsrv_query($conn, $tsql); if ($insertReview == false) { diff --git a/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php b/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php index d3744cf6..aca4c35f 100644 --- a/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php +++ b/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php @@ -94,14 +94,21 @@ if ($getProducts == false) { echo "Error deleting the UDF"; die(FormatErrors(sqlsrv_errors())); } -$tsql1 = "CREATE FUNCTION dbo.ifGetTotalItems (@OrderID INT) RETURNS TABLE WITH SCHEMABINDING AS RETURN (SELECT SUM(OrderQty) AS TotalItems FROM SalesLT.SalesOrderDetail WHERE SalesOrderID = @OrderID GROUP BY SalesOrderID);"; +$tsql1 = 'CREATE FUNCTION dbo.ifGetTotalItems (@OrderID INT) RETURNS TABLE WITH SCHEMABINDING AS RETURN ( + SELECT SUM(OrderQty) AS TotalItems FROM SalesLT.SalesOrderDetail + WHERE SalesOrderID = @OrderID + GROUP BY SalesOrderID +);'; $getProducts = sqlsrv_query($conn, $tsql1); //Error handling if ($getProducts == false) { echo "Error creating the UDF"; die(FormatErrors(sqlsrv_errors())); } -$tsql1 = "SELECT s.SalesOrderID, s.OrderDate, s.CustomerID, f.TotalItems FROM SalesLT.SalesOrderHeader s CROSS APPLY dbo.ifGetTotalItems(s.SalesOrderID) f ORDER BY SalesOrderID;"; +$tsql1 = "SELECT s.SalesOrderID, s.OrderDate, s.CustomerID, f.TotalItems +FROM SalesLT.SalesOrderHeader s +CROSS APPLY dbo.ifGetTotalItems(s.SalesOrderID) f +ORDER BY SalesOrderID;"; $getProducts = sqlsrv_query($conn, $tsql1); //Error handling if ($getProducts == false) {