Sybase Database

Sybase, a subsidiary of SAP, builds a client/server relational database management system. Products include Adaptive Server Enterprise (ASE), Adaptive Server Anywhere (ASA), Sybase Unwired Platform (SUP) for mobile applications, Afaria for enterprise mobile device management and IQ for data warehouse and big data applications.

Share tech news, updates, or what's on your mind.

Sign up to Post


as I know replication server is belongs to the Sybase server and any technology different between Sybase replication server( need a separate license I know) and MS SQL build replication.

why someone still use Sybase ASE replication server if MS SQL already has it and why don't simply migrate to MS SQL?

and it seems I never heard about Oracle replication server, how oracle handle replication ? all relies on data guard ?
I have a table in which one column(attribute) have multiple values on the coma seprated basis. Now i need to break them Or convert into 1nf, So please tell me how to do this.
EX-      name      phone        educaion
           abc          x                   10,12 ,14
          cde           e                    10

now it should be converted into....>
             name      phone          education    
              abc          x             10
              abc           x              12
              abc           x              14
              cde          e              10

I am trying to plot some long and lats from a Sybase 16 database into a SSRS Map report using SQL Server spatial query.

I am using the below code to generate the spatial data in Sybase:
ST_Geometry::ST_GeomFromText( 'POINT(1 1)' )

Open in new window

but when I click n next the wizard states that the dataset does not contain any spatial field.

Please help.

Thanks, Greg
I was using sybase ASE 15.03 and sybase replication server on the same version, recently, we upgraded the ASE on our production server to 15.7, can we keep using of sybase replication 15.03 or we have to renew its license?
kindly note we  also installed sybase 15.7 on DR site

please advice
Could anyone please explain when to use clustered and non cluster indexes in sybase ase?

Thanks in advance.

i know how to select top 100 rows or bottom 100 rows from sybase sql statement but how can get only middle rows like from 501 to 1000 rows,

for top 100.. i use
select top 100 * from tablename

for last 100.. i use
select top 100 * from tablename order by columnA

how can i pull out all rows from 501 to 1000 rows?

I am using Sybase IQ select @@version SAP IQ/ Linux64 - x86_64 - 2.6.18-194.el5/64bit/2015-11-21 01:29:07

I need to build a tree on a table which consists more than Million records which links for every order_id. Need to find what it was replaced by existing order_id until the end and eventually need to find the various quantities of each of these order_id and get the max out of it.

Below is my sample data
create table #tmporder ( account_key varchar(50) not null, order_id varchar(50) not null, msg_type varchar(5) not null, repl_by_order varchar(50) not null, replaces_order varchar(50) not null, quantity numeric(12) not null, order_datetime datetime not null, order_status varchar(1) not null );

INSERT INTO #tmporder (account_key,order_id,msg_type,repl_by_order,replaces_order,quantity,order_datetime,order_status) VALUES ('123456','6473','PL','0','0',1000,{ts '2016-10-07 07:59:10'},'1');

INSERT INTO #tmporder (account_key,order_id,msg_type,repl_by_order,replaces_order,quantity,order_datetime,order_status) VALUES ('123456','6473','MO','6480','0',1000,{ts '2016-10-07 07:59:10'},'5');

INSERT INTO #tmporder (account_key,order_id,msg_type,repl_by_order,replaces_order,quantity,order_datetime,order_status) VALUES ('123456','6474','PL','0','0',1000,{ts '2016-10-07 08:16:05'},'1');

INSERT INTO #tmporder (account_key,order_id,msg_type,repl_by_order,replaces_order,quantity,order_datetime,order_status) VALUES 

Open in new window

When I run sp_helpdb procedure I get the following information:

 device_fragments               size          usage                created                   free kbytes
 ------------------------------ ------------- -------------------- ------------------------- ----------------
 XX_data_01                       1024.0 MB data only            Nov 20 2015  2:08PM                  12400
 XX_data_02                       1024.0 MB data only            Nov 20 2015  2:52PM                  96432
 XX_data_01                       1024.0 MB data only            Nov 20 2015  3:26PM                 176784
 XX_data_02                       1024.0 MB data only            Nov 20 2015  4:05PM                 176800
 XX_data_01                       1024.0 MB data only            Nov 20 2015  4:54PM                 196720
 XX_data_02                       1024.0 MB data only            Nov 20 2015  5:08PM                 225680
 XX_data_01                       1024.0 MB data only            Nov 20 2015  5:19PM                 583200
 XX_data_02                       1024.0 MB data only            Nov 20 2015  5:34PM                 614080
 XX_data_01                       1024.0 MB data only            Nov 20 2015  6:00PM                 736784
 XX_data_02                       1024.0 MB data only            Nov 20 2015  6:29PM                 485808
 XX_data_01                       1024.0 MB data only            Nov 20 2015  7:06PM                 206848
 XX_data_02 …
I had this question after viewing SQL Query Producing decimal places when it shouldn't be.

Ok so now I have another issue....even though the DataGridView is showing the value correctly with 2 decimals, when I export the DataGridView to CSV, it STILL shows the 6 decimal places. Here is my export to CSV code:

  StreamWriter sw = new StreamWriter(file_path);

        if (headers)
            for (int i = 0; i < dgv.Columns.Count; i++)
                if (i != dgv.Columns.Count - 1)

        foreach (DataGridViewRow dr in dgv.Rows)

            for (int i = 0; i < dgv.Columns.Count - 1; i++)
                if (quotes)
                    sw.Write("\"" + dr.Cells[i].Value.ToString() + "\"");
                if (i != dgv.Columns.Count - 1)


Open in new window

I think it has to do with the .Value.ToString and the fact that it doesn't see the DefaultCellStyle.Format = "f2"

Hello Experts,

I am running the below query then displaying the results in a DataGridView in VS2015 (C#)

                                                    employee.empnum AS [Employee_ID],
                                                    punchclock.snum AS [DeptCode],
                                                    CONVERT(VARCHAR,punchclock.opendate,101) AS [Date],
                                                    CONVERT(VARCHAR(5), punchclock.punchin,108) AS [PunchTime],
                                                    CASE WHEN punchclock.typepunch = 4 THEN 'ID' WHEN punchclock.typepunch = 5 THEN 'OB' ELSE 'Error' END AS [PunchType],
                                                    punchclock.jobtype AS [EarnCode],
                                                    '' AS [TaxCode],
                                                    '' AS [Comments],
                                                    '' AS [LaborAllocationCode],
                                                    '' AS [Hours],
                                                    CAST(tip AS DECIMAL(10,2)) AS [Dollars],
                                                    '' AS [TemporaryRate]
                                                    punchclock, employee
                                                    employee.empnum = punchclock.empnum AND

Open in new window

I've Sybase ASE 15.7 version.

Often I have a process that fill up my transaction logs, to see which process is responsible for filling up the logs I run this query:

select loginfo('<dbname>', 'database_has_active_transaction'),
    loginfo('<dbname>', 'oldest_active_transaction_pct'),
       loginfo('<dbname>', 'oldest_active_transaction_spid'),
       loginfo('<dbname>', 'can_free_using_dump_tran'),
       loginfo('<dbname>', 'is_stp_blocking_dump'),
       loginfo('<dbname>', 'stp_span_pct')

and after I kill the spid to free up space

kill <oldest_active_transaction_spid>

To details of the session I use "sp_who" procedure or this query:
select spid, status, hostprocess, program_name, clientname, loggedindatetime
from sysprocesses

But I'd like to get more details about the session that filled up my transaction logs, for example I'd like to know the exact SQL text that is being executed for "oldest_active_transaction_spid".

In addition is there a system table or history log file where the statements by a SPID are stored?

Thanks in advance!

what is the difference between syslogin and sysusers in sybase database.

Hello Experts,

I have a SyBase database and when I select the field I get

9/19/2016 4:05:00 PM

I want to return only the the time portion in HH:MM 24 hour format....desired return is: 16:05

Another example:

9/19/2016 12:53:00 PM should return 12:53

I cant seem to find the right combination of date/time format to get me
We run a number of reports for our business throughout the day.
These queries are executed by the Task Scheduler via VB scripts.

The queries query our CRM database, and use an ODBC connection.

It appears, the queries "lock up" our CRM application whilst they're running.
The CPU usage spikes on the server when the queries are being run, and users complain their application freezes.

Does anyone have any ideas how we could minimise the impact? Restrict the CPU usage or something?

The database being queried is a sybase database.
I’m trying to create a web application that uses a Sybase database (Adaptive Server Anywhere 7) . The platform I use is visual studio 2015 community. When I’m running the application in debug mode from my computer, there is no problem. On the other hand when I publish my project and try to connect to the site from another computer I see this error: error im014 microsoft odbc driver manager the specified DSN contains an architecture mismatch between the Driver and Application.
I am new to this, so even though I’ve searched a lot and I understand that is something about 64bit application and 32bit DSN, I can’t make it work.
Any help is appreciated. If you need any more information please ask.
I am inserting records into a Sybase Table using
I am using a C# program to read in the records from a txt file named InputFile.txt into a Sybase table titled tableA.
One of the fields I read into tableA has a title "age" which has a datatype of varchar(3).
Let's say I read in the records as follows:

                   while ((line = file.ReadLine()) != null)
                        DataRow row = dt.NewRow();
                        row["age"] = line.Substring(45, 3);

Then I select the records from tableA insert them into another table, tableB that has a field titled "AgeDays" that is an INT type field. This is carried out as follows:

            AgeDays  )      
           CONVERT(INT, W.age) * 1 AS Expr4

If a record in the InputFile.txt has an Age value of '000' that is imported into the field tableA.age, what value would appear in tableB.AgeDays after the insertion statement is executed?
This question seems to be pointless. But we have an old stored procedure inserting data without a column list and there is a new column. Procedure is not working in test environment giving an error due to missing value for the new column. But it seems working in production. Is there a way to make such a procedure working?

More concretely, let's say we have table A with column a and b; and also a proc with an insert statement like "insert A values (x, y)"

Then column c with a default value has been added to table A. Is there a way to make the insert proc working even though there is no column list?

This is ASE 12.5.3
Dears, I have the following case and need some help please,

and sorry for my fresh experience with Sybase Replication.

I have one production server (sybase ASE 15.7) stores one production database.

I will install a replication server on a different server (but it is in the same building, so it will connect with the production server over LAN )

I will install replication server and create a new database repDB on it, and make employees retrieve reports from this database (to reduce load on production database)

so what is model  should I use for this replicate database?

On the other hand, I will install a new replication server on a far place (over WAN), and here I have to use Warm standby application, is this right,  even though the primary and standby database will be managed by different replication servers?? kindly note here I will use the first repDB (located on replication server in the same building with production server) as primary database.

Am I in the right way, and what are your suggestions about this issue?

please advice.

Thanks in advance
Suppose I have a simple table called transactions

Reference     Price
B1234            100
S1234             101
S2222              86
B2222              85

Can I do a simple query to match the B & S records or do I need to make a synthetic table to do the join?

Reference is always 5 characters with the 4 digit numeric identifying the pairs.

        WHEN substring(T1.Reference, 1, 1) = "S" THEN "B" + substring(T1.Reference, 2, 4) -- Sell
        WHEN substring(T1.Reference, 1, 1) = "B" THEN "S" + substring(T1.Reference, 2, 4) -- Buy
    end matching_reference,
    T1.Price- T2.Price
    transactions T1,
    transactions T2
    T2.Reference= matching_reference

I know I can't do the above... since it gives me a error in the joing not knowing "matching_reference"

Windows 2012, SQL 2008 STD.
I have a database of 60GB size, not too big.
I am trying to rebuild index and update statistics using SQL SMSS Maintenance Plan.
Rebuilding index went smooth, took less than 2 hours.
Now the next step is to update statistics.
I chose 'Column Only ' (because RebuildIndex does updating statistics on indexes as I read) and Full Scan option (because I saw a few report, there's not much difference between Fullscan and more than 25% sample rate).
The update statistics just take too long. Right now it's been running 4 hours, still keep going.
I read online, some guys having much bigger database like more than 500GB takes only 40 minutes or around.
My database takes too longer comparing to what I read online.
Some suggests to create clustered index, but I'm not allowed to change the database structure.

Why does my database take too long updating statistics? I can't  find answers. Is there anyway to identify and fix the problem?
Dears, what does mean the 'unknown device type' in description column in the result of sp_helpdevice ?

And for these devices, is it preferred to set dsync option to true and directio to false.

Are those two options (dsync and directio) affect on transaction log devices which are file system devices??
Dears, kindly note that I have installed a new sybase ase 15.7 on my server, and I have dump of mydb taken from 15.0.3 before install new version of sybase, now I want to:
load mydb dump (and I read it is automatically upgrader to sybase 15.7), but the problem is there is around 30 devices hold this db, and I don't want to recreate them on the server (kindly note the devices which was holding databases from ase 15.0.3 are still on the server)
so I think if I first load master dump which taken from 15.0.3 maybe into 15.7 and thoses devices already exists on the server will be in master..sysdevices??? then can smoothly load my database on those devices??
but I get the error : master database should be in single user mode, and I tried : sp_dboption master,"single user", true.
but this command faild to execute, also I try : startserver -fRUN_myserver -m ,(to put the ase server in single mode then load master)but I got the error: incorrect near m
so, please advice what can I do, and is this the right way I walk through to restore mydb???
thank you

i am running few jobs to connect sybase (12.5.4) and pull out few records. if i run one job at a time ..everything is fine but when i run 10 jobs parallelly i am getting sybase error..'layer=5, Origin=3, severity=0, number=6, Message = ct_fetch():network packet layer net library error.

strange part is I get this sysbase error only if i run jobs parallely.

any advice as which sybase config is blocking me.

kindly note we have two servers: sybase ase 15.7 and sybase 15.0.3

I need to upgrade sybase ase 15.0.3 to ase 15.7, I read about that and I will do the following steps:
as I will install ase 15.7 over existing 15.0.3:
1- shut down all services: sybase sql server, sybase bck server, sybase xp server.
2- use setup.exe for 15.7
3- start the server : $SYBASE/$SYBASE_ASE/install/startserver
4- select @@version it should be 15.7

then I will load dump file for mydatabase taken from 15.7 not from 15.0.3 , so no problem with loading,
I want to  ask somethings:
- Are the steps which I listed enough, or I missed something??
- also I think I should load master db (also from 15.7) to get all configures and logins, is this right??
- also are there post install tasks I have to do, please advice.
Dears, kindly note I have created an external login and a remote login as following: sp_addremotelogin remoteserver,locallogin1, remotelogin1 sp_addexternallogin remoteserver,locallogin1, remotelogin1

and I log in by user locallogin1 to the localserver to the database localdb and try to create proxy table from remotedb1 on remoteserver but still get the login failed error, any body know why??

kindly note there is localuser1 aliased to locallogin1 , i.e there is no user 'locallogin1' (direct mapping) on the database localdb where I try to create proxy table, rather there is a user localuser1 is alias to locallogin1, is this related to the problem??

please advice

Sybase Database

Sybase, a subsidiary of SAP, builds a client/server relational database management system. Products include Adaptive Server Enterprise (ASE), Adaptive Server Anywhere (ASA), Sybase Unwired Platform (SUP) for mobile applications, Afaria for enterprise mobile device management and IQ for data warehouse and big data applications.

Top Experts In
Sybase Database