print sql code example
Example 1: Cast for print sql
declare @x INT = 1
PRINT 'There are ' + CAST(@x AS VARCHAR) + ' alias combinations did not match a record'
Example 2: output data in sql
<?php
$con = mysqli_query("hostname", "username", "pwd", "database");
$sql = "SELECT * FROM `TABLE`";
$result = mysqli_query($con, $sql);
$check = mysqli_num_rows($result);
if($check > 0){
while($data= mysqli_fetch_assoc($result)){
echo $data["ColName"];
}
}
?>
Example 3: sql query print strings and int
print 'There are ' + cast(@Number as varchar) + ' alias combinations did not match a record'