Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql statement not processed when starting a bat file (ISQL)

Status
Not open for further replies.

brunoxbnlx

Programmer
Oct 9, 2003
3
US
Dear,
have a bat file, which I try to start using my windows explorer (start it with selecting the file and right click : open) ...

== this is the .BAT file =========
@echo on
d:
cd
REM **** first delete the prev log and rename the log to prev
cd \servname\Batch\admin

del del-hist-tables-INV-prev.log
rename del-hist-tables-INV.log del-hist-tables-INV-prev.log
cd
REM **** delete all H_ tables in database INV

isql -Sservername -Uuser -Ppassword -iD:\servname\batch\admin\test.sql -oD:\servname\batch\admin\del-hist-tables-INV.log

pause

exit
==== end of bat file ==================
Always when I tried to process it, nothing was mentionned in the log (=empty) (I also used -e in the ISQL command).

So I even put in the test.sql following statement (thought it would return an error) :
seletc count(*) from INV.dbo.H_COMPUTER
go

I did put on purpose 'seletc' instead of 'select' (even when the select statement is correct, it does not start

Nothing happened, so I think it seems never to open the test.SQL file ... but in the dos-prompt no special message is shown too (I'm getting the pause ... waiting to answer).

I do not know where to look for.

I tried starting a dos prompt using isql with the same login options (-S -U and -P) => I was able to do my select command .. and I got an asnwer as return

So I did not missed my password.

The only thing that does not happen is the SQL statement in the .SQL file.

details : we run sybase ase 12.0 (windows NT)

Thanks for your help
 
Hi

Try starting to making sure that it's the ISQL line causing hte problem.

Add "echo" comands to follow the progress and see where it 'dies'. Putting @echo on isn't enough.

Let me know what you get.




-=-=-=-=-=-=-=-=-
For ease of reading, any posted CODE should be wrapped by [ignore][COLOR][/COLOR] and
Code:
[/ignore] tags.

Ex:
Code:
SELECT 1 from sysobjects

 
Thanks for your reply but
the echo showed me what I already noticed (by putting the pause command I still could see the dos-prompt).
fyi : these are the messages :
=====================================================

D:\>REM **** delete all H_ tables in database INV

D:\>echo this is the isql
this is the isql

D:\>isql -Sservername -Uuser -Ppassword -iD:\servname\batch\admin\test.sql -oD:servname\batch\admin\del-hist-tables-INV.log

D:\>echo the isql should be finished
the isql should be finished

D:\>REM *** isql -Sservername -Uuser -Ppassword select count(*) from INV.dbo.H_COMPUTER go

D:\>pause
Press any key to continue . . .

=====================================================
Still no return of my SQL statement =>not on the dosprompt and not in my log.

As you can see I even tried to put in the ISQL the select statement .... the only thing that then happens that it opens a dos prompt logs in to ISQL ... but still have to re-enter my 'SELECT' statement.

Thanks for any other suggestion.

ps : (some more info) I do use tivoli to get on the server itself .. and starts from there the BAT file.

Regards.
Bruno
 
Hmmm I don't know Tivoli so I can't help you there.

Can you copy/paste the input file here. May not be the problem but I notice that you don't have a linefeed after your command and your 'go' statement.

Not ALWAYS the case but I have had problems with this on different flavours of the Unix platform.



-=-=-=-=-=-=-=-=-
For ease of reading, any posted CODE should be wrapped by [ignore][COLOR][/COLOR] and
Code:
[/ignore] tags.

Ex:
Code:
SELECT 1 from sysobjects

 
JeanNiBee,
tivoli is used to logon to our windows NT server.

I'm aware that if you have SQL file on UNIX that you need to be carefull about "unseen characters slipping into your statement" when you do not use any "unix editor".

But this problem normally do not occur under windows. (notepad or wordpad does not show any issue).

So for the time being I'm stuck.
It is not that urgent, but there should be a way to find out what is happening .. by having error messages ... echo is in this case not helpfull.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top