10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email.
spool table_update.html;
SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription';
spool off;
exit;
Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies
2. Shell Programming and Scripting
Hi ,
I have a sql query in the unix script ,whose output is shown below.I want to convert this output to HTML table format & send email from unix with this table as email body.
p_id src_system amount
1 A 100
2 B 200
3 C ... (3 Replies)
Discussion started by: jagadeeshn04
3 Replies
3. UNIX for Dummies Questions & Answers
Please read How To Ask Questions The Smart Way (1 Reply)
Discussion started by: balu_279013
1 Replies
4. Red Hat
hey , i am using this code to store value of a sql query and and then use
it in other query but after some time , but it is not working. please help
#!/bin/bash
val_1=$( sqlplus -s rte/rted2@rel76d2 << EOF
setting heading off
select max(stat_id) from cvt_stats;
exit
EOF
)
nohup... (5 Replies)
Discussion started by: ramsavi
5 Replies
5. Shell Programming and Scripting
Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database.
I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :(
What should I do? I'm not sure that... (2 Replies)
Discussion started by: Kapom
2 Replies
6. Shell Programming and Scripting
Hello ,
I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them .
I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies
7. Shell Programming and Scripting
Hi Friends,
I am using AIX version and sqlplus to connect to database while writing a shell script.
I have implemented three ways to connect to database :
1)
sqlplus -s <USERNAME>/<PASSWORD> <<!
@<SQL FILE TO EXECUTE>
exit
!
2)
sqlplus -s <USERNAME>/<PASSWORD> <<!
-----sql statemenets... (6 Replies)
Discussion started by: gauravgarg
6 Replies
8. Shell Programming and Scripting
HI,
We need a script that invokes the sql query every 14 days ans send email (0 Replies)
Discussion started by: bujjisveeru
0 Replies
9. Shell Programming and Scripting
Hello,
I have a sh script excuting a sql query through sqlplus. I am having trouble making my date equal to the date of the server time in the sql script. How can i call the server date from my query?
Thanks (2 Replies)
Discussion started by: kingluke
2 Replies
10. UNIX for Dummies Questions & Answers
Hello
To do :
'automate the process of generating report and send it to client every 15 days after encrypting the report file'
Did so far :
- generate Java program to encrypt the file.
- generate SQL query to run the report.
Is there any body who can help me to go further ?
... (7 Replies)
Discussion started by: cub
7 Replies
SQLSRV_QUERY(3) SQLSRV_QUERY(3)
sqlsrv_query - Prepares and executes a query.
SYNOPSIS
mixed sqlsrv_query (resource $conn, string $sql, [array $params], [array $options])
DESCRIPTION
Prepares and executes a query.
PARAMETERS
o $conn
- A connection resource returned by sqlsrv_connect(3).
o $sql
- The string that defines the query to be prepared and executed.
o $params
- An array specifying parameter information when executing a parameterized query. Array elements can be any of the following:
oA literal value
oA PHP variable
oAn array with this structure: array($value [, $direction [, $phpType [, $sqlType]]])
The following table describes the elements in the array structure above:
Array structure
+----------------------+---------------------------------------------------+
| Element | |
| | |
| | Description |
| | |
+----------------------+---------------------------------------------------+
| $value | |
| | |
| | A literal value, a PHP variable, or a PHP by-ref- |
| | erence variable. |
| | |
|$direction (optional) | |
| | |
| | One of the following SQLSRV constants used to |
| | indicate the parameter direction: SQL- |
| | SRV_PARAM_IN, SQLSRV_PARAM_OUT, SQL- |
| | SRV_PARAM_INOUT. The default value is SQL- |
| | SRV_PARAM_IN. |
| | |
| $phpType (optional) | |
| | |
| | A SQLSRV_PHPTYPE_* constant that specifies PHP |
| | data type of the returned value. |
| | |
| $sqlType (optional) | |
| | |
| | A SQLSRV_SQLTYPE_* constant that specifies the |
| | SQL Server data type of the input value. |
| | |
+----------------------+---------------------------------------------------+
o $options
- An array specifing query property options. The supported keys are described in the following table:
Query Options
+-----------------------+--------------------------------------+---+
| Key | | |
| | | |
| | Values | |
| | | |
| | Description | |
| | | |
+-----------------------+--------------------------------------+---+
| QueryTimeout | | |
| | | |
| | A positive integer value. | |
| | | |
| | Sets the query timeout in seconds. | |
| | By default, the driver will wait | |
| | indefinitely for results. | |
| | | |
|SendStreamParamsAtExec | | |
| | | |
| | | |
| | TRUE or FALSE (the default is TRUE) | |
| | | |
| | Configures the driver to send all | |
| | stream data at execution ( TRUE), or | |
| | to send stream data in chunks ( | |
| | FALSE). By default, the value is set | |
| | to TRUE. For more information, see | |
| | sqlsrv_send_stream_data(3). | |
| | | |
| Scrollable | | |
| | | |
| | SQLSRV_CURSOR_FORWARD, SQLSRV_CUR- | |
| | SOR_STATIC, SQLSRV_CURSOR_DYNAMIC, | |
| | or SQLSRV_CURSOR_KEYSET | |
| | | |
| | See Specifying a Cursor Type and | |
| | Selecting Rows in the Microsoft SQL- | |
| | SRV documentation. | |
| | | |
+-----------------------+--------------------------------------+---+
RETURN VALUES
Returns a statement resource on success and FALSE if an error occurred.
EXAMPLES
Example #1
sqlsrv_query(3) example
<?php
$serverName = "serverNamesqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "INSERT INTO Table_1 (id, data) VALUES (?, ?)";
$params = array(1, "some data");
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
?>
NOTES
For statements that you plan to execute only once, use sqlsrv_query(3). If you intend to re-execute a statement with different parameter
values, use the combination of sqlsrv_prepare(3) and sqlsrv_execute(3).
SEE ALSO
sqlsrv_prepare(3), sqlsrv_execute(3).
PHP Documentation Group SQLSRV_QUERY(3)