Page 1 of 1

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

Posted: Wed Jun 07, 2006 8:51 am
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.

Posted: Wed Jun 07, 2006 9:14 am
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,

Posted: Wed Jun 07, 2006 9:26 am
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.

Re: Sybase and SQL-Server ISQL command line

Posted: Wed Jun 07, 2006 9:34 am
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