on 2013 Jul 19 11:30 PM
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
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.