Skip to content

Commit cc8c554

Browse files
committed
Spread strings longer than allowed over multiple lines
1 parent bc6e125 commit cc8c554

File tree

2 files changed

+12
-3
lines changed
  • samples/tutorials/php
    • 1.0 PHP Configuration and Getting Started
    • 2.0 PHP Server programming - Stored procedures, Transactions, and UDFs

2 files changed

+12
-3
lines changed

samples/tutorials/php/1.0 PHP Configuration and Getting Started/test.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232

3333
sqlsrv_free_stmt($getProducts);
3434

35-
$tsql = "INSERT SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate) OUTPUT INSERTED.ProductID VALUES ('SQL Server 15', 'SQL Server 12', 0, 0, getdate())";
35+
$tsql = "INSERT SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate)
36+
OUTPUT INSERTED.ProductID
37+
VALUES ('SQL Server 15', 'SQL Server 12', 0, 0, getdate());";
3638

3739
$insertReview = sqlsrv_query($conn, $tsql);
3840
if ($insertReview == false) {

samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,21 @@
9494
echo "Error deleting the UDF";
9595
die(FormatErrors(sqlsrv_errors()));
9696
}
97-
$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);";
97+
$tsql1 = 'CREATE FUNCTION dbo.ifGetTotalItems (@OrderID INT) RETURNS TABLE WITH SCHEMABINDING AS RETURN (
98+
SELECT SUM(OrderQty) AS TotalItems FROM SalesLT.SalesOrderDetail
99+
WHERE SalesOrderID = @OrderID
100+
GROUP BY SalesOrderID
101+
);';
98102
$getProducts = sqlsrv_query($conn, $tsql1);
99103
//Error handling
100104
if ($getProducts == false) {
101105
echo "Error creating the UDF";
102106
die(FormatErrors(sqlsrv_errors()));
103107
}
104-
$tsql1 = "SELECT s.SalesOrderID, s.OrderDate, s.CustomerID, f.TotalItems FROM SalesLT.SalesOrderHeader s CROSS APPLY dbo.ifGetTotalItems(s.SalesOrderID) f ORDER BY SalesOrderID;";
108+
$tsql1 = "SELECT s.SalesOrderID, s.OrderDate, s.CustomerID, f.TotalItems
109+
FROM SalesLT.SalesOrderHeader s
110+
CROSS APPLY dbo.ifGetTotalItems(s.SalesOrderID) f
111+
ORDER BY SalesOrderID;";
105112
$getProducts = sqlsrv_query($conn, $tsql1);
106113
//Error handling
107114
if ($getProducts == false) {

0 commit comments

Comments
 (0)