Page 1 of 1

How to run SELECT from command line

Posted: Mon Jan 21, 2008 5:04 am
by rajendharreddy
Hi,

Can anybody tell me how to run SELECT statement from command line?

SELECT NAME FROM DS_JOBS WHERE JOBTYPEIND='2'

I want to execute above query from command line and get all the sequence names list to a file.

Thanks.

Posted: Mon Jan 21, 2008 7:04 am
by ray.wurlod

Code: Select all

DSHOME=`cat /.dshome` ; export DSHOME
. ${DSHOME}/dsenv
cd ProjectDirPath
${DSHOME}/bin/dssh "SELECT NAME FMT '40T' FROM DS_JOBS WHERE JOBTYPEIND = '2';"

Posted: Mon Jan 21, 2008 8:57 pm
by rajendharreddy
Hi Ray,

Thanks for the reply. Code that you have given can be run in UNIX server. But my server is WINDOWS.

Could you please tell me the command that can be executed from WINDOWS.

Thanks.

Posted: Mon Jan 21, 2008 9:58 pm
by rajendharreddy
Thanks Ray, i tried it is working in windows server.

Posted: Tue Jan 22, 2008 6:04 am
by rajendharreddy
Hi,

When I fire any query in DS Administrator I am getting some header in my output. Please see output below.

Query:

SELECT DISTINCT EVAL DS_JOBOBJECTS."INDEX(@RECORD,'\:vTableName:\',1) > 0", DS_JOBS.NAME AS JOB_NAME FMT '40L' FROM DS_JOBS,DS_JOBOBJECTS WHERE DS_JOBS.JOBNO = DS_JOBOBJECTS.OBJIDNO ORDER BY 1,2;

Output:

TRANS ( DS_JOBOBJECTS , J\ : @RECORD < 5 > : \ROOT , 31 , X )
if TRANS ( DS_JOBOBJECTS , J\ : @RECORD < 5 > : \ROOT , 40 , X ) = 2 then Y else N
DEPEND_JOBS........................ SEQ.......

product_load Y
product_staging

1 records listed.


From the above result I would like to filter unwanted lines like (TRANS, DEPEND_JOBS and 1 records listed.).

Since I am running it in a automated fashion DSDesign.exe is not able to report the jobs.

Could anybody tell me how to get this done?

Thanks.

Posted: Tue Jan 22, 2008 6:35 am
by AmeyJoshi14
Hey! What is the output when you run your Select query"SELECT NAME FROM DS_JOBS WHERE JOBTYPEIND='2' ;" in Datastage Administrator? :?

Posted: Tue Jan 22, 2008 7:06 am
by rajendharreddy
Output is as follows

Job name.............

product_seq
time_seq


Job name............


geography_seq
personicx_seq


Job name...........

Posted: Tue Jan 22, 2008 7:37 am
by chulett
Search for 'suppress', it has been mentioned several times. Freebie:

viewtopic.php?t=111199

Posted: Tue Jan 22, 2008 7:38 am
by ray.wurlod
You can not, if you are using EVAL, suppress the EVAL message. EVAL expressions must be compiled, and the compiler reports its output. There is no way to disable this.

However, you're trying to cheat on us. The output you give is not from the query you give; the query you give does not have any EVAL in it.

The TRANS functions you have in EVAL expressions can more easily be done with joins, that do not need to be compiled. On the down side, however, you would need field definitions for records 31 and 40 in the file dictionary of DS_JOBOBJECTS for an approach using joins to work.

The "1 records listed." message can be suppressed by using COUNT.SUP in the query immediately before the semi-colon. Column headings and report headings can also be suppressed with the SUPPRESS COLUMN HEADING clause before the ";" query terminator.