SET SHOWPLAN [ON|OFF]
is a session-level command in Sybase ASE, it's not a server-level setting (if it was a server-level setting you'd be able to alter it via sp_configure
). Can you run wireshark (or something similar) on the packets being sent from the JDBC client to see if it's setting showplan on as part of the session initialization?
That said - showing the plan should not affect database CPU or memory usage, the plan is generated by the query optimiser anyway. However, showing the plan will increase network utilization.
Sybase ASE will not allow you to directly delete rows from multiple tables using a wild card, but it's pretty simple to create a script to find the table names, and loop through them.
You can find the tables names by querying sysobjects
within the database.
To find all the tables with the prefix Table_
you would do:
select name from myDatabase..sysobjects
where type = "U"
and name like "Table\_%" escape "\"
In the above query "U"
is the flag for User defined tables. Also because _
is a single character wild card in T-SQL, we have to escape it to find the literal _
. T-SQL allows almost any character to act as the escape, but it must be defined after the like
clause. Finally %
is the multi-character wild card, the T-SQL equivalent to *
in *nix and DOS.
It would also be possible to use the above query to build a sql script. We start by telling the server not to print out the number of rows affected by the query using set nocount
. This allows us to create a script that will run error-free, without needing additional editing.
set nocount on \\supressess rows affected printout
select "delete from " +name+ " where type = 1" + char(10) + "go"
from myDatabase..sysobjects
where type = "U"
and name like "Table\_%" escape "\"
go
If you execute this from isql
and using the -b
flag to supress headers, and -o
flag to redirect output to a file, it will build a script that can then be executed directly.
isql -Uusername -Ppassword -Sservername -b -omyScriptToDeleteData.sql -iSQLToFindTables.sql
Best Answer
We ended up using the SymmetricDS application and have been moving applications over to MSSQL gradually. So far, so good! Thanks for the help everyone.