Good Afternoon, I have the following mock up script of my code. It appears that the following will not work with PHP and returns no error, but the query is sent to the SQL Server which I can see in a profiler trace. PHP Returns no response.
Ideas?
Will work with PHP:
SELECT * FROM TABLE
Will not work with PHP:
DROP TABLE #TMP1
SELECT 50 AS INT INTO #TMP1
SELECT * FROM #TMP1
Will not work with PHP:
DECLARE @TABLE TABLE
(
ID INT
)
INSERT INTO @TABLE (ID)
SELECT 40
SELECT * FROM @TABLE
Will not work with PHP:
<?php
$databaseName = "DB" ;
$serverName = "3424.34.234.3";
$uid = "sdfsf";
$pwd = "Jsdfsf";
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd ,
"Database"=>$databaseName);
/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect( $serverName , $connectionInfo);
$tsql = "
DECLARE @TABLE TABLE
(
ID INT
)
INSERT INTO @TABLE (ID)
SELECT 40
SELECT * FROM @TABLE
";
//EXEC PLAYER_LOOKUP '$result';
/* Execute the query. */
$stmt = sqlsrv_query( $conn, $tsql);
//Working Query
/* Iterate through the result set printing a row of data upon each iteration. BR=."\n" */
while($row = sqlsrv_fetch_ARRAY($stmt, SQLSRV_FETCH_ASSOC)){
{
echo $row;
}}
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>