Database Administrators
Q&A for database professionals who wish to improve their database skills
Latest Questions
0
votes
1
answers
199
views
Sybase SQL Anywhere 17 - Can a database trigger call a system command?
I have a Sybase SQL Anywhere 17 server running on Linux, and I was wondering if it is possible to create a database trigger to execute a local operating system system command when an UPDATE is down on a particular database record? Essentially, if a database table.field is updated to "complete", exec...
I have a Sybase SQL Anywhere 17 server running on Linux, and I was wondering if it is possible to create a database trigger to execute a local operating system system command when an UPDATE is down on a particular database record?
Essentially, if a database table.field is updated to "complete", execute /usr/local/bin/notify
I have done this previously with other database systems, but looking over the SQLAW17 documentation, I can't find any references on how to do this (the trigger documentation seems to refer to stored procedures etc, not clear if I can or should do this as a stored procedure, etc).
Any advice would be appreciated!
Peter Alexander
(1 rep)
Oct 3, 2023, 03:01 PM
• Last activity: Jun 28, 2025, 03:02 PM
3
votes
1
answers
757
views
Sybase ASA: Saving and dropping all foreign keys and most Primary Keys for (Bulk) Insert
**Background Information:** I am trying to migrate from an ASA 12 Database, to a ASA 12 Database by using a Remote Server. I have to migrate a lot of Rows (not all), spread over a lot of tables (not all). The migration will be done table by table. That means I have written a C# Programm and a lot of...
**Background Information:**
I am trying to migrate from an ASA 12 Database, to a ASA 12 Database by using a Remote Server.
I have to migrate a lot of Rows (not all), spread over a lot of tables (not all).
The migration will be done table by table.
That means I have written a C# Programm and a lot of Statements to select the needed Records from the Source-DB (proxy Tables) and insert them in the target db/tables.
I have droped all Primary Keys, all foreign keys and all indexes.
This was done to increase performance, to facilitate the table by table migration and to start quicker on developing the Programm.
**My Problem:**
I need a way to select all Foreign Keys of one Owner, generate their "Create"-Statements and save those to a Table so I can recreate them once the migration is over. (Same Problem for PKs and Indexes)
Currently the fastest way is to use Sybase Central, Click on Indexes, order by Owner/Type, select all foreign Keys, Ctrl-C and Ctrl-V into a Editor. That will give me all "Create"-Statements for the selectet Objects.
I would rather have a script that could generate all "Create"-Statements, but seeing as most information about Foreign Keys is spread over 11 Systemtables/-views I am not able to build a Statement that will give me all Informations that I need.
I also have tried using the Unload-Tool of Sybase Central which will give me all Foreign-Key Statements. But seeing as that is also a long and manual way of doing it, it is not an improvement.
Does anyone have a better way or has anyone maybe written a Script that strips a Database of all foreign Keys to rebuild at a later point in time?
DLA2014
(157 rep)
Jun 12, 2014, 09:18 AM
• Last activity: Jan 21, 2025, 11:07 PM
0
votes
1
answers
132
views
SQL Anywhere 17 Silent Installation
My requirement is, Administration Tools (32-bit) and SQL Anywhere 32-bit (Server as well as client enabled) I have passed the silent installation command in my Dockerfile setup.exe /s ....... So on Regkey etc and SA32=1 AT32=1 It gets installed successfully, but server 32-bit is not enabled because...
My requirement is, Administration Tools (32-bit) and SQL Anywhere 32-bit (Server as well as client enabled)
I have passed the silent installation command in my Dockerfile
setup.exe /s ....... So on Regkey etc and SA32=1 AT32=1
It gets installed successfully, but server 32-bit is not enabled because when I verified dbeng dbserv all these files are missing in Bin32 folder
There are no additional commands to enable the SQL Anywhere 32-bit (server) feature, and client is by default enabled.
What do I do? Please share your knowledge!
fathima farwa
(1 rep)
Dec 21, 2024, 10:04 PM
• Last activity: Dec 24, 2024, 03:13 AM
0
votes
1
answers
49
views
count number of unique occurrence of each value in 1st or 2nd column and print in 3rd column
``` SELECT domain_Job.statusCode as "Status Code", lookup_JobStatusCode.name as "Status Code Description" FROM domain_Job, domain_Client, lookup_JobStatusCode, domain_MasterServer, lookup_JobType, lookup_JobState WHERE domain_Job.type = lookup_JobType.id AND domain_Job.statusCode > 1 AND domain_Job....
SELECT
domain_Job.statusCode as "Status Code",
lookup_JobStatusCode.name as "Status Code Description"
FROM
domain_Job, domain_Client, lookup_JobStatusCode, domain_MasterServer, lookup_JobType, lookup_JobState
WHERE
domain_Job.type = lookup_JobType.id AND
domain_Job.statusCode > 1 AND
domain_Job.statusCode = lookup_JobStatusCode.id AND
domain_Job.id = domain_Job.ParentJobID AND
domain_Job.state = lookup_JobState.id AND
domain_Job.clientName = domain_Client.name AND
DATEDIFF(hour,UTCBigIntToNomTime(domain_Job.endTime), GETDATE()) <=24 AND
domain_Job.policyName != ''
GROUP BY domain_Job.statusCode, lookup_JobStatusCode.name, domain_MasterServer.networkName, lookup_JobType.name, lookup_JobState.name
output :
Status Code | Status Code Description
47 | host is unreachable
7648 | -
96 | unable to allocate new media for backup, storage unit has none available
191 | no images were successfully processed
806 | this mpx group is unjoinable
47 | host is unreachable
7648 | -
156 | snapshot error encountered
20 | invalid command parameter
4234 | VMware server login failure
user3016638
(1 rep)
Jul 11, 2019, 07:06 AM
• Last activity: Sep 24, 2023, 03:26 PM
0
votes
1
answers
1767
views
Get Updated_At for any change in row on Sybase?
I am working with a Sybase SQL Anywhere table that has horrible tracking of changes. I have a windows service that queries multiple tables every 5 minutes looking for changes, but one particular table doesn't have any timestamps. In addition to that, when I added a new record, it was given an ID in...
I am working with a Sybase SQL Anywhere table that has horrible tracking of changes. I have a windows service that queries multiple tables every 5 minutes looking for changes, but one particular table doesn't have any timestamps. In addition to that, when I added a new record, it was given an ID in the middle for some reason. There are 15,000 records and the new ID was 6775, so simply asking for records that have an ID greater than the last won't work.
I know in MySQL I could alter the table with something like:
ALTER TABLE
customer
ADD updated_at
DATETIME on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
Which would auto update that value any time anything was changed. That doesn't work with Sybase, so my next thought was to create a second small table:
CREATE TABLE customers_getting_updated(
customer_id int,
updated_at DATETIME,
PRIMARY KEY(patient_id)
)
and then set a trigger to create / update records in that table. There are currently 150 columns in the table. I tried creating a trigger like this:
create TRIGGER "customer_record_updated" AFTER INSERT ON customer
for each row begin
INSERT INTO customers_getting_updated (patient_id, updated_at)
VALUES(:NEW.customer_id, NOW());
end;
I am running this on a dual processor 6 core with 64GB memory on a SSD and the query has taken 15 minutes and still hasn't finished.
Assuming this will finish eventually (I saw someone say one took them 70 minutes????), since I didn't get an error up front, is there a better way since most computers that need to run this will have substantially less hardware power.
FYI - I tried doing a AFTER INSERT OR UPDATE
but got an error on the OR
, so I assume I will have to write separate triggers.
Alan
(207 rep)
Sep 4, 2018, 04:45 PM
• Last activity: Apr 1, 2023, 11:04 AM
0
votes
2
answers
142
views
Holding transactions as long as a user edits
As an application developer I'm used to using databases transactions only as a way to play in modifications after a user has clicked "save". That's the way most database servers I'm familiar with expect their transactions to be used and they don't like long-lived transactions. Under many circumstanc...
As an application developer I'm used to using databases transactions only as a way to play in modifications after a user has clicked "save".
That's the way most database servers I'm familiar with expect their transactions to be used and they don't like long-lived transactions. Under many circumstances, they lead to locking out other writers or even readers with very little help to deal with such blocks.
But I'm only familiar with a slice of the database world - I use mostly SQL Server and have seen some MySQL. Those databases are mostly used as an application storage with business logic in the database itself mostly being reduced to generating unique ids in one way or another.
I could imagine that other servers, such as Oracle, have different expectations.
The approach I'm interested in is that where when the user clicks "edit", a transaction is opened and all edits the user makes are immediately send to the database. All business logic is therefore applied immediately and as such visible in the user interface even before the "save" (a.k.a. the "commit").
This paradigm would make several things easier:
- The application doing the edit doesn't have to manage preliminary ids for unsaved rows as ORMs do.
- The user could get feedback from business logic in the database server, such as values of computed columns or the resulting effects of triggers, even before they commit to the changes.
- Constraint violations could be detected earlier in the edit if a lot of changes are made before the commit.
- If the database server has good support for it, conflicting editing from multiple transactions could lead to better error messages such as "user abc is editing row xyz".
[I've investigated the state of SQL Server support for this approach](https://dba.stackexchange.com/questions/318050/the-finer-points-of-writers-locking-each-other-out-under-the-snapshot-isolation) and it's something on the verge of being possible but probably usually a bad idea in practice. The main issue is that writers there lock each other out even under snapshot isolation. In particular, the writer who writes first wins, not the one who commits first.
My question is: Are there database servers that support this scenario better? What does Oracle have to say to this, for example? In particular, the server would have to
- Allow concurrent writes to the same row without blocking and having the first committer win.
- Therefore, an uncommitted, dangling transaction that has written should not affect other users at all. If a different user commits a conflicting write that should work, and the dangling transaction just becomes uncommittable (or is just automatically rolled back at that point).
I'm looking into this for my [generic database browser](https://squil.azurewebsites.net) ;
John
(775 rep)
Oct 10, 2022, 08:54 PM
• Last activity: Oct 11, 2022, 02:10 PM
0
votes
1
answers
1216
views
SQL Anywhere 12 - exporting data to Excel
Do I need to install MS Office Excel on machine where is SQL Anywhere 12 server for below code to work? Or SA 12 or Windows have MS Excel Driver builtin? SELECT * FROM SalesOrders; OUTPUT USING 'Driver=Microsoft Excel Driver (*.xls); DBQ=c:\\test\\sales.xls; READONLY=0' INTO "newSalesData";
Do I need to install MS Office Excel on machine where is SQL Anywhere 12 server for below code to work?
Or SA 12 or Windows have MS Excel Driver builtin?
SELECT * FROM SalesOrders;
OUTPUT USING 'Driver=Microsoft Excel Driver (*.xls);
DBQ=c:\\test\\sales.xls;
READONLY=0' INTO "newSalesData";
BlueMark
(247 rep)
Mar 2, 2016, 08:46 PM
• Last activity: Jun 19, 2022, 06:53 PM
1
votes
1
answers
447
views
Ubuntu - Sybase - PHP not able to connect
I'm trying to connect Sybase 17 from PHP(7.4, 8.0) Laravel running on apache2 on Ubuntu(18.4) system. We are using SQL Anywhere. Sybase is not installed on the same server. >We are getting this error - Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/opt/sqlanywhere17/l...
I'm trying to connect Sybase 17 from PHP(7.4, 8.0) Laravel running on apache2 on Ubuntu(18.4) system. We are using SQL Anywhere. Sybase is not installed on the same server.
>We are getting this error - Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/opt/sqlanywhere17/lib64/libdbodbc17_r.so' : file not found, SQL state 01000 in SQLConnect in /var/www/html/sybaseconnection.php on line 14
We've already performed the below steps:
1. Already verified libdbodbc17_r.so file is there.
2. Necessary permission is already given.
3. Able to connect using Telnet and command line to SQL Anywhere 17.
Rahul
(115 rep)
Jun 24, 2021, 11:07 AM
• Last activity: Jun 25, 2021, 07:05 AM
5
votes
1
answers
2331
views
How to configure connection accessing Sybase Anywhere from Sybase IQ via ODBC on Linux
I'm trying to access an ASA16 server from IQ16 via ODBC driver. Both servers are installed on the same Linux box. I've installed `unixodbc-bin` and added a file .odbc.init into home of user running the databases: [mes_input] Driver=/opt/sqlanywhere16/lib64/libdbodbc16_r.so uid=dba pwd=SQL EngineName...
I'm trying to access an ASA16 server from IQ16 via ODBC driver. Both servers are installed on the same Linux box.
I've installed
unixodbc-bin
and added a file .odbc.init into home of user running the databases:
[mes_input]
Driver=/opt/sqlanywhere16/lib64/libdbodbc16_r.so
uid=dba
pwd=SQL
EngineName=mes_input
CommLinks=tcpip(host=127.0.0.1;port=49152)
AutoStop=no
DatabaseName=mes_input
The ASA is running on 49152 on that box; IQ is running default 2638.
Also I've added an entry into interfaces file locking like that:
mes_input
master tcp ether myserver 49152
query tcp ether myserver 49152
Back on IQ I can add via Sybase Central the remote server as well as tables from this box. Also testing the connection and is showing no error.
But when I'm now trying to copy some data from ASA via e.g.
INSERT locale_table LOCATION 'mes_input.mes_input' 'SELECT * FROM table'
I'm getting:
Connectivity libraries cannot be found (check your dynamic library
search path). Selects from attached databases are not possible without
these libraries.
-- (hqmlib/hqm_cpm.cxx 146)
SQLCODE=-1003005, ODBC 3-Status="HY000"
Zeile 1, Spalte 1
Something I've missed or missconfigured?
frlan
(495 rep)
May 5, 2014, 02:36 PM
• Last activity: Jun 19, 2021, 08:12 AM
0
votes
1
answers
2539
views
SQL Anywhere 17 - Database server connection limit exceeded
I set up a new SQL Anywhere 17 Database in Sybase Server. I've got a lot of clients that should be able to connect to the Database over ODBC. The ODBC works fine but as soon as the third user tries to connect i get the following message: [![enter image description here][1]][1] I've tried ```select @...
I set up a new SQL Anywhere 17 Database in Sybase Server. I've got a lot of clients that should be able to connect to the Database over ODBC. The ODBC works fine but as soon as the third user tries to connect i get the following message:
I've tried
Does anyone have any idea what I can cause this problem?

@@max_connections
and got 32'766.
Also when I execute the folowing statement I get the following result:
SQL
SELECT
PROPERTY('ServerEdition') as ServerEdition,
PROPERTY('IsNetworkServer') as IsNetworkServer,
PROPERTY('LicenseType') as LicenseType,
PROPERTY('LicenseCount') as LicenseCount,
PROPERTY('MaxConnections') as MaxConnections
FROM dummy

Janik Spies
(103 rep)
Mar 17, 2021, 02:25 PM
• Last activity: Mar 18, 2021, 12:04 PM
1
votes
1
answers
239
views
Trigger creation for Sybase SQLAnywhere 16
I've been having the hardest time trying to create a trigger for a Sybase SAP SQLAnywhere 16 database following [these docs.][1] Currently it's -131 syntax erroring on line 15/16 (the update statement), but I don't see any error in the syntax. What am I doing wrong here? create trigger "DBA"."WKM_au...
I've been having the hardest time trying to create a trigger for a Sybase SAP SQLAnywhere 16 database following these docs.
Currently it's -131 syntax erroring on line 15/16 (the update statement), but I don't see any error in the syntax. What am I doing wrong here?
create trigger "DBA"."WKM_autoFillCL143" after insert order 2 on "DBA"."case_checklist"
when ((select top 1 "inserted"."code" from "inserted") in( '143' ) )
begin
declare @parentRef integer;
declare @desc varchar(255);
declare @desc1 varchar(255);
declare @checkID integer;
set @parentRef = (select top 1 "parent_ref" from "inserted");
if (@parentRef '0')
then
set @desc = (select "description" from "case_checklist" where "checklist_id" = @parentRef);
if (@desc is not null)
then
set @checkID = (select top 1 "checklist_id" from "inserted");
update "WKM_RecordChecklistMapping" set "c143" = @checkID where "c142" = @parentRef;
declare @tabid integer;
set @tabid = (select top 1 "tab_id" from "WKM_recordChecklistMapping" where "c142" = @parentRef);
set @tabid = (select top 1 "tab_id" from "user_tab2_data" where "tab_id" = @tabid);
if (@tabid is not null)
then
declare @recProvider varchar(255),@recsRequested varchar(255),@dateFrom "datetime",@dateTo "datetime"
set @recProvider = (select top 1 "Provider_Name" from "user_tab2_data" where "tab_id" = @tabid);
set @recsRequested = (select top 1 "Records_Requested" from "user_tab2_data" where "tab_id" = @tabid);
set @dateFrom = (select top 1 "For_Dates_From" from "user_tab2_data" where "tab_id" = @tabid);
set @dateTo = (select top 1 "Through" from "user_tab2_data" where "tab_id" = @tabid);
set @desc1 = 'Receipt '+@recProvider+' Records? '+@recsRequested+', dates '+"coalesce"(convert(varchar(255),@dateFrom,1),'00/00/00')+' to '+"coalesce"(convert(varchar(255),@dateTo,1),'00/00/00');
set @checkID = (select top 1 "checklist_id" from "inserted");
update "case_checklist" set "description" = @desc1,"staff_assigned" = 'ZKS',"due_date" = ("today"()+7) where "checklist_id" = @checkID
end if;
end if;
end if;
end;
boog
(153 rep)
Feb 15, 2021, 08:49 PM
• Last activity: Feb 16, 2021, 08:42 PM
0
votes
1
answers
71
views
Counting number of occurrences, how to "group by"
I have the following query, which works as intended. Database is Sybase SQLAnywhere, which follows t-sql syntax for the most part. I'm trying to add a column to COUNT the number of times each "referred_link" occurs on the table called "cases". Num_refs is the total number of times a specific "cases....
I have the following query, which works as intended. Database is Sybase SQLAnywhere, which follows t-sql syntax for the most part.
I'm trying to add a column to COUNT the number of times each "referred_link" occurs on the table called "cases".
Num_refs is the total number of times a specific "cases.referred_link" exists on the cases table, for each referrer.
Expected output:
casenum: casetype: date_opened: client: referrer: num_refs:
30293 MVA 1/1/2021 Joe Smith Maggie G 3
10293 SF 1/4/2020 Ben R Simon A 4
Here's the query:
select casenum,
matcode as casetype,
date_opened,
sp_first_party(casenum) as client,
sp_name(referred_link,1) as referrer,
(case when mailing_list is null then 'No' else 'Yes' end) as old_mattar_star,
'repeat client' as reason
from cases
inner join party on cases.casenum=party.case_id
left join (select * from mailing_list_defined where mailing_list='Mattar Stars') a on party.party_id=a.names_id
where party.role='Plaintiff'
and party.our_client='Y'
and date_opened>='##STARTDATE##'
and date_opened=2)
UNION ALL
select casenum,
matcode,
date_opened,
sp_first_party(casenum) as client,
sp_name(referred_link,1) as referrer,
count(sp_name(referred_link,1)) as num_refs,
(case when mailing_list is null then 'No' else 'Yes' end) as old_mattar_star,
'personal referrer' as reason
from cases
inner join names on cases.referred_link=names.names_id
left join (select * from mailing_list_defined where mailing_list='Mattar Stars') a on names.names_id=a.names_id
left join provider on names.names_id=provider.name_id
left join party on cases.casenum=party.case_id
where names.person='Y'
and date_opened>='##STARTDATE##'
and date_opened='##STARTDATE##'
and date_opened<='##ENDDATE##'
) as num_refs,
but I'm getting an error "Function or column reference to 'casenum' must also appear in a GROUP BY"
Can anybody help me straighten this out?
boog
(153 rep)
Jan 28, 2021, 09:01 PM
• Last activity: Jan 28, 2021, 09:59 PM
1
votes
2
answers
3230
views
Connecting SQL Anywhere with Sybase database file on local computer
I have installed SQL Anywhere 12 in my system. I have a `.db` file in my computer. I have no idea what is it's username and password. If I try to connect to it by providing credentials- username=DBA and password=sql I'm getting below error- [![enter image description here][1]][1] [1]: https://i.ssta...
I have installed SQL Anywhere 12 in my system.
I have a
How can I connect to it successfully?
.db
file in my computer. I have no idea what is it's username and password.
If I try to connect to it by providing credentials- username=DBA and password=sql
I'm getting below error-

soccer7
(159 rep)
May 23, 2016, 05:51 AM
• Last activity: Aug 3, 2020, 11:26 AM
0
votes
1
answers
19586
views
Want to change a timestamp date to an integer YYYYMMDD
I have this input "2017-07-21 15:31:04.853453" and I want it to return "20170721" as output. How can I do it using `cast` or `convert` function? My column input is the current time (`CURRENT_TIMESTAMP`). From `cast(CURRENT_TIMESTAMP as date)` I have the output "2017-07-24", then I can do several con...
I have this input "2017-07-21 15:31:04.853453" and I want it to return "20170721" as output. How can I do it using
cast
or convert
function?
My column input is the current time (CURRENT_TIMESTAMP
).
From cast(CURRENT_TIMESTAMP as date)
I have the output "2017-07-24", then I can do several concatenates with substrings. It should work but I wonder if there isn't any other way to get "integer YYYYMMDD".
Pedro Pereira
(1 rep)
Jul 21, 2017, 02:38 PM
• Last activity: Apr 21, 2020, 11:23 AM
1
votes
1
answers
100
views
Next 10% of rows
I know TOP can return first 10% of row results, but how would I then get the next 10%? I am trying to break up a query that crashes due to insufficient memory (java.lang.OutOfMemoryError), and want to return the first 10% of results, then edit it so it returns the next 10%, and so on. I am using SQL...
I know TOP can return first 10% of row results, but how would I then get the next 10%?
I am trying to break up a query that crashes due to insufficient memory (java.lang.OutOfMemoryError), and want to return the first 10% of results, then edit it so it returns the next 10%, and so on.
I am using SQL Anywhere 12.
KAE
(143 rep)
Apr 6, 2020, 04:15 PM
• Last activity: Apr 6, 2020, 06:26 PM
0
votes
0
answers
533
views
Import Sybase SQL Anywhere 8 DB into SQL Server without access to Sybase
This is my first post here and its a doosy. I am facing what seems to be a unique situation at the moment. I am in the process of moving my client to a new environment which includes decommissioning super old equipment. One of the last remaining pre-2008 servers is Windows 2000 IBM server running a...
This is my first post here and its a doosy. I am facing what seems to be a unique situation at the moment. I am in the process of moving my client to a new environment which includes decommissioning super old equipment. One of the last remaining pre-2008 servers is Windows 2000 IBM server running a Sybase SQL Anywhere 8 database with Jaguar. Since this server is so old and still in light use, my primary concern was taking a full backup of data in the event of failure.
The OS on this server is in bad shape and running any exe causes it to hang, so I could not install any third-party backup. I took a full drive and state backup with the native windows backup utility (in safe mode) into a bkd file. After taking a backup now the Jaguar service always hangs on start, so its essentially broken. Rather than fix a 2000 server I want to find a way to get this old database onto a new server.
I restored that backup to a temp 2008 VM by copying the dlls for NTBackup off of the 2000 server so it could hand bkd. This way I could experiment on a non-prod copy of the data.
As one would expect the software doesn't work on a restored copy, partly due to 2000 using WINNT in place of system32, so my focus has shifted to converting the Sybase db file to SQL Server. I did find "Stellar Converter for Database" and ran the db file through that on a trial as a proof of concept and the data preview is in fact readable, but unfortunately I don't think my client will pay the $200. It seems well worth it, but my hands are tied on that front.
I also found the Microsoft "SQL Server Migration Assistant for Sybase" and it seems promising, however it requires I connect to the Sybase db itself, which I cannot do since it is broken. I also tried searching the internet for a download of SQL Anywhere 8 or 9 with no luck. I did find 12, but it was client only.
The previous IT also did not document the logins for this database at all, so its looking grim.
Does anyone have any pointers on options to get this Sybase 8 .db file into a Microsoft SQL Server 2017 (I have ISOs of older ones on hand) .mdf file without access to the actual old db server, and without any credentials?
I know I recently reset an SA account on another of our old SQL Servers by putting the db in offline mode and running some sqlcmd magic, but I am no way familiar with Sybase.
I do not have high hopes and I am fully aware that the answer may be "its dead Jim". I appreciate any input, even if its not what I want to hear.
rrrrowsdower
(1 rep)
Mar 27, 2020, 03:45 PM
• Last activity: Mar 28, 2020, 09:48 AM
1
votes
0
answers
155
views
UNLOAD TO status message
I am running a query with an [UNLOAD][1] statement to save the results into a CSV file, ``` UNLOAD SELECT ... FROM ... WHERE ... TO 'C:\\TEMP\\MyFile.csv' QUOTE '"'; ``` I am getting status updates like ``` 55% (1182880573 of estimated 2147483647 rows) complete after 01:10:00; estimated 00:57:04 rem...
I am running a query with an UNLOAD statement to save the results into a CSV file,
UNLOAD
SELECT
...
FROM
...
WHERE
...
TO 'C:\\TEMP\\MyFile.csv'
QUOTE '"';
I am getting status updates like
55% (1182880573 of estimated 2147483647 rows) complete after 01:10:00; estimated 00:57:04 remaining
and so on for 58%, 62%, etc. Does the update refer to the **amount of time to write MyFile.csv, the amount of time to run the query**, or both? That will help me figure out if the bottleneck is creating the file vs. running the query. The file size grew on disk over time to 539 GB, and the estimate undershot since it started giving values like,
769% (3635495259 of estimated 2147483647 rows) complete after 16:30:00
When I killed the query, it reported an execution time of 59706 seconds, so I think this retrieved a row, saved it to the file, retrieved the next row, and so on, but it would be nice to confirm.
I am using Sybase SQL Anywhere 12.
KAE
(143 rep)
Mar 24, 2020, 08:44 PM
• Last activity: Mar 27, 2020, 01:05 PM
-1
votes
1
answers
146
views
Sybase: Replacement for TimeSeries()
Is there any build in replacement which is doing similar to TimeSeries() of MS SQL on Sybase ASA/IQ? I'm having a starttime and an endtime as well as an intervall and needs to generate a list of all steps in between.
Is there any build in replacement which is doing similar to TimeSeries() of MS SQL on Sybase ASA/IQ?
I'm having a starttime and an endtime as well as an intervall and needs to generate a list of all steps in between.
frlan
(495 rep)
Apr 9, 2014, 12:25 PM
• Last activity: Nov 6, 2019, 04:06 AM
1
votes
1
answers
480
views
How to select 2 fields in where clause
I want to match 2 pair of fields in where clause select * from A where (x,y) in (select u,v from B) Can some one guide me
I want to match 2 pair of fields in where clause
select * from A where (x,y) in (select u,v from B)
Can some one guide me
user181865
(11 rep)
May 29, 2019, 11:37 AM
• Last activity: May 29, 2019, 12:53 PM
1
votes
0
answers
95
views
Escape from Alcatraz: SqlAnywhere to MSSQL
Is there a migration tool that actually works for SAP SqlAnywhere 17 to MSSQL (any recent version)? Searching for "sqlanywhere mssql migration" yields a variety of hits including SQL Server Migration Assistance (SSMA) but all of the tools I have tried — various free and some trials of commercial off...
Is there a migration tool that actually works for SAP SqlAnywhere 17 to MSSQL (any recent version)?
Searching for "sqlanywhere mssql migration" yields a variety of hits including SQL Server Migration Assistance (SSMA) but all of the tools I have tried — various free and some trials of commercial offerings — all failed to handle the following test (assume T is a real table with columns A and B):
SELECT A, B + 'X' AS B1 FROM T GROUP BY B1
SqlAnywhere permits this but on MSSQL the symbol
B1
is not in scope in the GROUP BY
clause, and the query must be transformed as follows:
SELECT * FROM (SELECT A, B + 'X' AS B1 FROM T) AS T1 GROUP BY B1
I wasn't even able to test SSMA. It is available for a range of platforms including Sybase ASE but is _not_ compatible with the database formerly known as Sybase SqlAnywhere and now titled SAP SqlAnywhere. I've tried this, and it is not interested in using my SqlAnywhere ODBC drivers.
If there isn't an out of the box migration tool then is there anything that can transform syntax? In some ways this would be even more helpful than a migration tool because our applications are riddled with queries that exhibit this particular incompatibility. I seriously considered writing a transformation myself but quickly realised that SQL syntax is hideously complex and idiosyncratic.
Peter Wone
(223 rep)
Mar 20, 2019, 02:44 AM
• Last activity: Mar 20, 2019, 10:39 PM
Showing page 1 of 20 total questions