Sybase and SQL-Server (not 2005) ISQL command line

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Sybase and SQL-Server (not 2005) ISQL command line

Post by kcbland »

This is not a DS question, but I thought someone out there may have an answer. Google is not working well for me today, and Sybase and Microsoft can't seem to get me to the answer.


I need to run a SQL script from a DS job. The script has a few variables in it that need resolution at runtime (from date and to date). Something like:

Code: Select all

TRUNCATE TABLE mytable
INSERT INTO mytable (SELECT thiskey FROM bigtable WHERE loaddate BETWEEN '%fromdate%' AND '%todate%'
COMMIT
GO
QUIT
I want DS to do this, where ISQLstub.ksh is a wrapper script to ISQL command line:

Code: Select all

CommandLine="ISQLstub.ksh -S myserver -U myuser -P mypassword -I myscript ":FromDate:" ":ToDate
Call DSExecute("UNIX", CommandLine, ScreenOutput, ReturnCode)
Outside of enhancing ISQLstub.ksh to parse the SQL script, substituting %fromDate% and %todate%, and writing a temporary SQL script with the substituted values to use instead, does anyone know a way to have ISQL resolve "parameters"? Oracle sqlplus does this using &1, &2, &3, etc, but I could't find where you can do this with ISQL.
Last edited by kcbland on Wed Jun 07, 2006 11:46 am, edited 1 time in total.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I am not familiar with iSQL but on googling it, i came up with this.
According to this website, even iSQL takes in parameter like &1, &2 and so on.
It might be no help but just try the website out.
Regards,
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Thanks, but that isn't ISQL for Sybase or SQL-Server. My findings so far says that it can't be done the way I'd like, but I was hoping for some solution better than the one I'm facing.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Re: Sybase and SQL-Server ISQL command line

Post by rwierdsm »

kcbland wrote: Oracle sqlplus does this using &1, &2, &3, etc, but I could't find where you can do this with ISQL.
Shot in the dark, been awhile since I've worked with ISQL, but I seem to recall ?1, ?2 ?3 instead of &1 &2 and &3.

Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
Post Reply