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

I have a table that has certain rows. I need a query to check if the data in the table were inserted in the ascending order.

E.g: Below. I will filter the value codes 80,81. CLCL_ID and CLCL_LINE_NO is the unique in table.

I need a query to get the CLCL_IDs if those rows marked in RED in the below screenshot.

Solutions in SQL Server are also welcome. I will try to convert it to Sybase.
I'm having trouble fixing the syntax in this statement:
SELECT Administrator_VhStock.[NO], Val(Right([BR],1)) AS BR2, IIf(Administrator_VhStock.Usage="D","D",IIf(Administrator_VhStock.Usage="L","L",IIf(Administrator_VhStock.Usage="G","S",IIf(Administrator_VhStock.Usage="O","H",IIf(Administrator_VhStock.Rental_Status="R","R",IIf(Administrator_VhStock.SALESDATE Is Not Null,"V",IIf(Administrator_VhStock.STOCK_STATUS="P","O","I"))))))) AS STAT
FROM Administrator.VhStock
WHERE NO = varStockNo
I have an issue with InfoMaker 12.0. Currently we have an existing report with a request to enhance the report to allow multi-select. The SPROC [EXEC dbo.SPROC ( a int, b int );]. The setup window is setup correctly and has been running fine until I select the MS checkbox and save the changes. The datatype for parm 2 changes to string from integer and throws a warning error at runtime for the report.

Any thoughts?
Hello Experts,

I have a query that I need some help with. I narrowed down the problem to being with the HowPaid table. It seems all of my "Sums" are being summed erroneously because of multiple entries from the HowPaid table. If I remove the full outter join and the CC Tips column, everything is good.

Results = Pic1
cast(refcode  as INT)  as 'Payroll ID',
EMPNAME  as 'EmpFirstName',
Sum(reghours) as 'Reg Hours',
JobPos.Descript as 'Position',
punchpayroll.payrate as 'Pay Rate',
Sum(IsNull(Overtime,0))   as 'Overtime',
Sum(punchpayroll.tip) as 'Tip',
Sum(IsNull(DoubleD,0)) as 'Double Time',
sum(howpaid.change) as 'CC Tip'
from dba.punchpayroll 
(select overtime.punchindex,sum(Case When overtimepay =150 then length else 0 end) as Overtime,
sum(Case When overtimepay =200 then length else 0 end) as DoubleD
from dba.overtime
LEFT OUTER JOIN dba.overtimehourrule
 ON overtime.ruleid = overtimehourrule.ruleid
group by overtime.punchindex
) ov
ON punchpayroll.punchindex =ov.punchindex
INNER JOIN dba.employee ON employee.empnum = punchpayroll.empnum and employee.isactive = 1
inner join dba.JobPos on   punchpayroll.jobtype= JobPos.JobPos
full outer join dba.howpaid on punchpayroll.punchindex = howpaid.punchindex and methodnum in (SELECT METHODNUM FROM DBA.METHODPAY WHERE AUTHREQR = 2)
where  punchpayroll.opendate between 20150601 and 20150615
Group by refcode,EMPNAME,EMPLASTNAME, jobpos.descript, punchpayroll.payrate
ORDER BY  emplastname, 

Open in new window

We are using branch-specific Software in Win Server 2008.  Reporting, offers, invoicing is done via Crystal Reports 8.5.  Where the applications transfers data to Crystal Reports, we are recently experiencing hangups.  We have to shut down and restart the server in order to use the software again, as everything locks up for all users.

Does anyone have similar experiences?  Any ideas for possible causes?
Hi there,

I am trying to save files which are stored in BLOB fields in a Sybase database.

The routine below seems to work, files are being saved in my folder, but when opening them they seem to be corrupt. For example when I open a Word or Excel file it needs to be repaired (by Office) before I can read the contents.

procedure TForm1.saveBlobs;
var tmpFilename: String;
    tmpList: TStringList;
  While not Query1.Eof do begin
    tmpFilename := prgPath + '_output\' + Query1.FieldByName('DOCU_ORG_FILENAME').AsString;

    tmpList := TStringList.Create;


Open in new window

Could my routine be the root cause of these corruptions?

Could you please help me out? Notice: I am using Lazarus (@Windows), not all Delphi stuff is available.

Kind Regards,
I have a client that wants to leave MediSoft for whatever reason.  They want their data exported to CSV.  I've got a copy of the database and I have the data dictionary file (Medisoft using Advantage database).  However, I can't seem to get MS Access to get into any of the tables via ODBC.  

Has anyone ever done this before?  I think I'm missing a password or something.  Any help would be appreciated.

Hi guys,

How can i create a backup of an oracle database, copy the files to a USB EXTERNAL HD, go to a different office and server and restore that database exactly the same it was before but on a different server.

Please be very detailed about it, im not a DBA.

Thanks in advance.

After upgrading the SAP Sybase patch we are facing the Sybase service issue. .i.e   in Microsoft cluster Sybase  service fail over is not working. if we try to move one node  to other node the service going to disable. please see the below error and give any solution.

Cluster resource 'SYBSQL_LEP' in clustered service or application 'Sybase ASE for LEP' failed.

Hello Experts,

The value of column scheduledate = 12/30/1899 that is a DateTime field

I have this case statement

case when header.scheduledate = 18991230 then 'No' else header.scheduledate end as 'Future Order',

It is not producing my desired results which in this case is 'No'. In this case I am getting '11/1/2015' I have no idea where this date is even coming from?

How can I convert bigint in Sybase to a normal representation of a day and time. For example I have in Sybase value of the EndTime bigint -->      1,441,126,804
I am doing a report so need to show it in the date format.
I'm working with a table which holds versions of vacancies...

It has fields:

vacID (char16, which is a FK)
vacDetails (string)
dateCreated (date)

and others which are not relevant

For each vacID, there will be 1 or many rows, each with a seperate dateCreated.

However, I only want to return the latest row (ie. semantically the current version of the vacancy), for each vacancy.

I *can* edit the table to include a ROWID (a pk) field if needs be, but would like to see both options if possible - with ROWID and without ROWID.

how do I do this?
many thanks
Hi All,

I`ll appreciate modifying code to improve it`s performance.
thanks in regard,
there is the code:
with KT 
(Document_Id, Handle,AccountBranchId, AccountNumber , TaskName,ActionID, CustomerIdentity, CustomerSeq,CustomerFirstName, CustomerLastName, CustomerPhone )

(select distinct 
concat('                                                                                                                                                                                                                                                                                                                                                        KT-',cast(Document_Control_ID as varchar(50))) Document_Id,
concat('                                                                                                                                                                                                                                                                                                                                                        ',cast(cast(open_date as date format 'DD-MM-YYYY') as char(10)),'          KT-',cast(Document_Control_ID as varchar(49))) as Handle,
substring(a.account_id,4,3)  as AccountBranchId,
concat('0000',substring(a.account_id,8,6))  as AccountNumber,

when account_type_code = 3 then 
when Account_Attribute_Code = 826 then 
when partycount = citizenshipIlCount and partycount = residencyIlCount and Account_Attribute_Code = 61 then

Open in new window


I'm trying to find the equivalent of temporary tables in Sybase in Oracle.

Is there any mechanism in Oracle that can replicate the speed and functionality of temporary tables in Sybase?

Appreciate any information!
I have Sybase database and Microsoft SQL 2008 on windows 2008 R2 64 bit.
I need to know what should be installed from Sybase so that I can create a Linked server at the SQL level?

Hi our server was rebooted yesterday and when it came back online i saw the sqlserver wasn't connecting when i tried to restart the process its starts briefly then stops after a few seconds in the logs tail i see these statements. When i try to go into sql studio to try and look at the properties setting or to try and backup and truncate i cant because it will not connect to the instance since msqlserver service keeps stopping. Ive tried to put in single user mode the T flags i still cant get it to work and keep the process up so i can see whats going on. Can someone explain if they ever seen this

Error: 17053, Severity: 16, State: 1.
2015-07-20 00:08:51.34 spid9s      D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\modellog.ldf: Operating system error 1450(Insufficient system resources exist to complete the requested service.) encountered.
2015-07-20 00:08:51.34 spid9s      Error: 9002, Severity: 17, State: 2.
2015-07-20 00:08:51.34 spid9s      The transaction log for database 'model' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
2015-07-20 00:08:51.34 spid9s      Could not write a checkpoint record in database ID 3 because the log is out of space. Contact the database administrator to truncate the log or allocate more space to the database log files.
2015-07-20 00:08:51.34 spid9s      Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting…
I want to know how this statement works:
Select FieldName & 1 > 0  from tablename

I can't find any documentation on this
I'm using Sybase Sql Anywhere
I'm trying to create a linked server to SYBASE database. I've installed Sybase client on the MS SQL 2008 machine and created ODBC connection and tested it and working fine.

On MS SQL, once I try to create the linked server, I'm receiving the attached error
I have been given 2 raw Sybase databases - the .db and .log files for each.  Each .db is under 1.4GB.

We do not have access to the front-end that the database was populated using, and the raw data needs to be accessed so that queries and reports can be made against the data. However, we are unsure of exactly what type of data the DBs hold - we don't know the schema. If we could export the schema, I could present it to the end users on the team and a developer to decide what information is useful to import into a new live DB, what rows and columns are linked, what their labels/names are, etc, etc.

I am a network, Microsoft Server NT - 2012 and Exchange admin (14 years) with very little DB knowledge outside of work in IIS. The Sybase DBs are not live, so I can put then through any type of filter, tool or migration I need to in order to present what it holds and how it holds/organizes the data (containers) to the project manager. I would even import it into SQL or Access if I needed (of course I have a few archived/backup copies of the raw Sybase DBs).

So I am not only looking for the proper tool (we are willing to purchase what we need), but a little hand holding as well - I need to produce the schema of the 2x Sybase databases first. Then I need a tool that will allow us to make queries and generate reports on the data once we know exactly what the data is.

So a little DB 101 - 300 if anyone could.

We have an old Sybase server whose database is acting up.  We have tried rebuilding the file-system and the database file.  But the problem returns.  We want to replace the hard drive that the database-files and transaction-files are stored.  We want to determine exactly which hard drive it is because we are not familiar with Unix.  Moreover, we also want to see if those files are stored in the same hard drive as the operating system or not; if they are, we will need to re-install the operating system as well as restoring the database to the new hard drive.  Please help me to determine these two things.

So far, I have found these:

•      I use sp_helpdb command and sp_helpdevice command and find that the database files and the transaction files are stored in these physical devices:


Open in new window

•      I want to know more about those physical devices.  I use the following commands to examine them:

df -k /dev/rdsk/c0t0d0s1
df -k /dev/rdsk/c0t3d0s4
df -k d_master
df -k /dev/rdsk/sybdbs2

Open in new window

The df command complains that the first three devices are “not a block device, directory or mounted resource”.

On the other hand, the df command shows the following info for the last device:

Filesystem        kbytes   used  avail capacity Mounted on
/dev/dsk/c0t3d0s0 576558 371019 147889    71%   /

Open in new window

In any case, this doesn’t tell me which drive(s) those devices are on.

•      We don’t see any …
I use to run this query from linked server in sql2008 R2, it works fine

select   * from openquery(TRW-XT-UX1,'set rowcount 10; select  * from Product_Attributes')

But when I use isql from sybase, it does return me error...

so I wonder what is different between the two ??
Hello Experts,

I released a new build of my application and now on 64bit machines I am getting this error:

ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

This was working fine on my last build and I didnt really change anything that has to do with the ODBC or anything like that.

        'Look for SQL Engine
            Dim str As String = "DSN=sqlbase;uid=dba;pwd=password;"
            Dim con As New OdbcConnection(str)
            Dim com As String = ("select company from sysinfo")
            Dim Adpt As New OdbcDataAdapter(com, con)
            Dim ds As New DataSet()
        Catch ex As Exception
            MessageBox.Show("SQL Engine not running! Closing application.  " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Exit Sub
        End Try

Open in new window

SyBase SQL Anywhere v10 VS2010

Is there any document explains the contents of sysstatistics (histogram  structure & density)  in detail and the algorithm used in query costing?  

Hello Experts,

I am using SyBAse SQL Anywhere v10. This is my query

select top(1) CASHTIPS from TipPool where opendate = 20150601 order by LASTUPDATE desc

Open in new window

This works great except if CASHTIPS value is null, it returns a "0". I would like to return NULL if the result is NULL. I have tried to use case when but I cant figure out how to use that in conjunction with top

We have a very old SUN SPARC workstation running Solaris 2.4 (SunOS v5.4).
It's being used to run Sybase. The database in it is acting up.  We have a spare SUN workstation with nearly identical specs  and are trying to restore the backup database from workstation to the other.  
When we try to do this, we get the following  error message:

Msg 7205, Level 17, State 2:
Line 1:
Can't open a connection to site 'SYB_BACKUP'.  See the error log file in the SQL Server boot directory.

Unfortunately I don't know where the error log file is.  I am not familiar with Solaris.

That is how we tried to restore the database backup:
1.  Use RCP to copy the dump file from the spare server to the primary server. And name the copy "frombkup_mydb.dump".
2.  Drop the old database from the primary server, and re-create an empty one.
3.  Then use the following command to load the database from the backup dump file:

load database mydb from "/export/home/syb11.dump/frombkup_mydb.dump"

Does anyone know why the restore doesn't work?

Please help if possible.

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

No Top Experts for this time period. Answer questions to earn the title!