09-14-2011
A handy trick for data extraction is "Select 'dAtA AS X, t.* from table_name t where ...." so the data lines have a good hook for conversion. This was robust for almost any anount of data, too. The most robust was using <PRE> and good padding/spacing in place of tables (browser does not have to typeset every cell before sizing the columns, fixed pitch typesetting is very cheap).
Smart apps with passwords on the command line re-exec() to remove it, probably passing it in the environment or an open tmpfile(). I always did ok by echoing it into the input stream.
Since php has a database interface, why not use it?
Last edited by DGPickett; 09-14-2011 at 10:03 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How do I create a K Shell which would silently (without user input) logon to Oracle and
run an SQL script?
Any help will be greatly appreciated.
Steve (1 Reply)
Discussion started by: stevefox
1 Replies
2. Shell Programming and Scripting
Hi-
I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment...
I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies
3. Shell Programming and Scripting
hi Friends,
Please help me in writing shell script to run list of sql files.
database is Oracle 9i,
unix os is solaris
Requirement is
1. sql file must take two inputs a)feed id and b)business date
2.shell script must out put .xls or .csvfile as out put without trimming any column name and... (1 Reply)
Discussion started by: balireddy_77
1 Replies
4. Shell Programming and Scripting
I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this?
Is there a way to have a persistent connection to oracle database... (9 Replies)
Discussion started by: vel4ever
9 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
Hi,
I have a query regarding execution of a sql query having long listing of parameters ..I need to execute this query inside a shell script.
The scenario is like....
Suppose I have a file abc.txt that has the card numbers..it could be in thousands..
then I need to fire a query like
... (12 Replies)
Discussion started by: vsachan
12 Replies
7. Shell Programming and Scripting
Hi Experts,
I have a list of Dbs.In that DBs i need to execute some sql scripts.
each sql script is unique and it should run on particular DB only.
For example. i have DBs like MDC20V,NDC20V,ODC20V and sql scripts like MD.sql,ND.sql,OD.sql.so MD.sql should run only in MDC20V and ND.sql should... (1 Reply)
Discussion started by: navsan420
1 Replies
8. Shell Programming and Scripting
Please share the doc asap as very urgently required. (1 Reply)
Discussion started by: 24ajay
1 Replies
9. Shell Programming and Scripting
How can i run sql queries from UNIX shell script and retrieve data into text docs of UNIX? :confused: (1 Reply)
Discussion started by: 24ajay
1 Replies
10. Shell Programming and Scripting
I want to run sql query in shell script and output data save as delimited text (delimited text would be comma)
Code:
SPOOL_FILE=/pgedw/dan.txt
SQL=/pgedw/dan.sql
sqlplus -s username/password@myhost:port/servicename <<EOF
set head on
set COLSEP ,
set linesize 32767
SET TRIMSPOOL ON
SET... (8 Replies)
Discussion started by: Jaganjag
8 Replies
LEARN ABOUT PHP
mssql_select_db
MSSQL_SELECT_DB(3) MSSQL_SELECT_DB(3)
mssql_select_db - Select MS SQL database
SYNOPSIS
bool mssql_select_db (string $database_name, [resource $link_identifier])
DESCRIPTION
mssql_select_db(3) sets the current active database on the server that's associated with the specified link identifier.
Every subsequent call to mssql_query(3) will be made on the active database.
PARAMETERS
o $database_name
- The database name. To escape the name of a database that contains spaces, hyphens ("-"), or any other exceptional characters,
the database name must be enclosed in brackets, as is shown in the example, below. This technique must also be applied when
selecting a database name that is also a reserved word (such as primary).
o $link_identifier
- A MS SQL link identifier, returned by mssql_connect(3) or mssql_pconnect(3). If no link identifier is specified, the last
opened link is assumed. If no link is open, the function will try to establish a link as if mssql_connect(3) was called, and use
it.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
mssql_select_db(3) example
<?php
// Create a link to MSSQL
$link = mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'phpfi');
// Select the database 'php'
mssql_select_db('php', $link);
?>
Example #2
Escaping the database name with square brackets
<?php
// Create a link to MSSQL
$link = mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'phpfi');
// Select the database 'my.database-name'
mssql_select_db('[my.database-name]', $link);
?>
SEE ALSO
mssql_connect(3), mssql_pconnect(3), mssql_query(3).
PHP Documentation Group MSSQL_SELECT_DB(3)