cancel
Showing results for 
Search instead for 
Did you mean: 

.BAT file taking input parameter, invoquing ISQL and passing parameter to SQL Batch Question

Former Member
0 Kudos

Greetings,

It has been a while so I would appreciate some help.

I think I recall that you can code a .BAT file to access ASE via ISQL, submit SQL CODE and take a parameter in from the command line. I am trying it, but I don´t quite remember the syntax. Can somebody spot the mistake?

The command line parameter should be "%1". The error message indicate that "<<" was not expected...

Thank you and regards.

Jean-Pierre

Here´s the .BAT file contents

isql -Usa -Ppassword -SPC1 -e <<EOF

USE test

GO

 

CREATE TABLE #temp

(

   a   VARCHAR(255) NULL

)

INSERT INTO #temp  

  SELECT     

    CASE          

       WHEN CHARINDEX("%1", UPPER(SUBSTRING(a,1,30))) = 0 THEN NULL              ELSE UPPER(SUBSTRING(a,1,30))    

    END  

FROM test..x

SELECT * FROM #temp WHERE a iS NOT NULL

GO

EOF

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Ok, this works perfectly well in any flavour of UNIX or Linux if you hard code what you are looking for. In other words, "<" rather than "%1". It even works on Windows with a shell like Cygwin.

I have to further improve this to pass in what I am looking for to the command file. Straightforward, I think, in Unix. More difficult in Windows.

Any suggestions on how to complete the command file, welcome.