I'm creating this process on uDeploy that uses iSQL to execute sql files. My problem is that I have to set the server and db name in the process.
In the SQL file - we may need to use other db's so it'd have to include USE DBNAME GO in the file.
However, it hasn't been reaching/executing the update statement after the USE statement.
Is there anything in relation to sybase, isql, that doesn't allow this? Can you only do one statement from isql?
typical linux cmd being run is
sybase.sh; isql -U username -P **** -S servername:port -D dbname -X -i sqlfile.sql
SQL file example:
USE dbname
go
update table set field = 'date' where field1 ='blahblah' and field2 ='blah'
go
edit:
This might be because the DBNAME is being set in the command. Can anyone confirm?
Some background:
From the command line:
>script<
in the database named>dbname<
(assuming your login has access to the>dbname<
database; otherwise the script will be run in your login's default database)In a script:
>dbname<
...>dbname<
and ...>dbname<
database then you should get an error message and the follow-on query(s) will be run in your default databaseYour (probable) issue:
isql / -D >dbname<
will set the destination database ...use >dbname<
in the script will take precedence and determine which database you're ultimately placed in prior to running the follow-on query(s)An example ...
-D
argument is provided on theisql
command line, the script will place you in thetempdb
database prior to running theselect
Now if we add a
-D
flag ...isql
command line option-D master
will initially place your session in themaster
database ...tempdb
databaseselect
will be run in thetempdb
database