Putting query result dynamically to one cell of table from shell
I have to send a data in mail table format.only one cell need to get dynamically from query.
my code is like
in ......... I am trying to get query result.By putting query directly it prints the query in mail body.I want the result to print
Moderator's Comments:
Please use CODE tags when displaying sample input, sample output, and code segments, as required by Forum Rules.
Last edited by Don Cragun; 08-10-2016 at 12:19 AM..
Reason: Add CODE tags.
:)
Suppose,I have one table A. Table A have one column. Table A have 10 rows. I want this 10 rows store into shell script variable.
like
#!/bin/ksh
v_shell_var=Hi
here in call oracle , through loop How can I store table A's 10 rows into v_shell_var (Shell Script Array).
Regards,
Div (4 Replies)
Hello,
Can someone please advise me how to put the db2 query reult into an array?
For example, the query reults are:
string A
string B
string C
Then how do I put them into array=string A
array=string B
... (2 Replies)
Hi, unix gurnis
I need help for following requirement for writing a shell scritp.
log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file.
Thanks in advance (2 Replies)
Hi,
I need a shell script, which would search the result values from another files.
1)execute " select column1 from table_name" query on the table.
2)Based on the result, need to be grep from .wft files.
could please explain about this.Below is the way i am using.
#!/bin/sh... (4 Replies)
Hi,
I wrote the below script to get the query result from a Syabase DB.
isql -s -U **** -P **** SYBASE SERVERNAME
USE ***(Database name in Sybase)
@command.sql
But im not getting the output. Can anyone help me on this (2 Replies)
I have a postgres sql statement that is the following:
select age from students;
which gives me the entries:
Age
---
10
15
13
12
9
14
10
which is about 7 rows of data.
Now what I would like to do with this is use a shell script to create an array age. As a results... (3 Replies)
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)
Hello,
I am newbie on mysql and trying to edit my database from terminal under linux.
What I need to do is to change the information written in a cell in table.
Let me explain what I tried:
$ mysql -u mysqluser -p
$ show databases;
$ USE catalogue;
$ show tables ;
$ select * from... (2 Replies)
I have below 2 requirements for parameterize the generate the extract file from Oracle table using Shell Script. Could you please help me by
modifying the script and show me how to execute it.
First Requirement:
I have a requirement where I need to parameterize to generate one... (0 Replies)
Discussion started by: hareshvikram
0 Replies
LEARN ABOUT PHP
mssql_result
MSSQL_RESULT(3)MSSQL_RESULT(3)mssql_result - Get result dataSYNOPSIS
string mssql_result (resource $result, int $row, mixed $field)
DESCRIPTION mssql_result(3) returns the contents of one cell from a MS SQL result set.
PARAMETERS
o $result
- The result resource that is being evaluated. This result comes from a call to mssql_query(3).
o $row
- The row number.
o $field
- Can be the field's offset, the field's name or the field's table dot field's name (tablename.fieldname). If the column name has
been aliased ('select foo as bar from...'), it uses the alias instead of the column name.
Note
Specifying a numeric offset for the $field argument is much quicker than specifying a fieldname or tablename.fieldname argu-
ment.
RETURN VALUES
Returns the contents of the specified cell.
EXAMPLES
Example #1
mssql_result(3) example
<?php
// Send a select query to MSSQL
$query = mssql_query('SELECT [username] FROM [php].[dbo].[userlist]');
// Check if there were any records
if (!mssql_num_rows($query)) {
echo 'No records found';
} else {
for ($i = 0; $i < mssql_num_rows($query); ++$i) {
echo mssql_result($query, $i, 'username'), PHP_EOL;
}
}
// Free the query result
mssql_free_result($query);
?>
The above example will output something similar to:
Kalle
Felipe
Emil
Ross
Example #2
Faster alternative to above example
<?php
// Send a select query to MSSQL
$query = mssql_query('SELECT [username] FROM [php].[dbo].[userlist]');
// Check if there were any records
if (!mssql_num_rows($query)) {
echo 'No records found';
} else {
while ($row = mssql_fetch_array($query)) {
echo $row['username'], PHP_EOL;
}
}
// Free the query result
mssql_free_result($query);
?>
NOTES
Note
When working on large result sets, you should consider using one of the functions that fetch an entire row (specified below). As
these functions return the contents of multiple cells in one function call, they're MUCH quicker than mssql_result(3).
SEE ALSO
Recommended high-performance alternatives: mssql_fetch_row(3), mssql_fetch_array(3), mssql_fetch_assoc(3), mssql_fetch_object(3).
PHP Documentation Group MSSQL_RESULT(3)