Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
How To Receive Returning Result from a Query?
Submitted by: AdministratorWhen you execute a SQL SELECT statement with the odbc_exec() function, you can capture the returning result with a result set object with the following syntax:
$result_set = odbc_exec($sql_statement);
#- The returning value could be a Boolean value FALSE,
#- if the execution failed.
Data rows and field values in the result set object can be retrieved using other ODBC functions as shown in the tutorial PHP script below:
<?php
$con = odbc_connect('ggl_SQL_SERVER','sa','GlobalGuideLine');
$sql = 'SELECT GETDATE()';
$res = odbc_exec($con, $sql);
odbc_fetch_row($res);
$date = odbc_result($res,1);
print("Database current time: ". $date ." ");
odbc_close($con);
?>
If you run this script, you will get something like this:
Database current time: 2007-06-02 22:07:05.110
Submitted by: Administrator
$result_set = odbc_exec($sql_statement);
#- The returning value could be a Boolean value FALSE,
#- if the execution failed.
Data rows and field values in the result set object can be retrieved using other ODBC functions as shown in the tutorial PHP script below:
<?php
$con = odbc_connect('ggl_SQL_SERVER','sa','GlobalGuideLine');
$sql = 'SELECT GETDATE()';
$res = odbc_exec($con, $sql);
odbc_fetch_row($res);
$date = odbc_result($res,1);
print("Database current time: ". $date ." ");
odbc_close($con);
?>
If you run this script, you will get something like this:
Database current time: 2007-06-02 22:07:05.110
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.