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

Create table #test...
Insert into #test...
Update #test
Select * from #test

Are all these sybase statements possible with a single prepare, execute and fetch call in perl dbi?
Otherwise whats the option?
Hi Experts

Since a long time I didn't follow the PowerBuilder technology, I've been using version 7.

Could you please give me a sumarized guidance on how to becoming actualized to the newest version?

Thanks in advance
I'm trying to call a stored procedure on a Sybase adaptative server.
The connexion to the database is ok. I can call a stored procedure with : sybase_query(call myproc(), $resid). It works and the proc return lines.
I need to call a stored proedure with two params, when i call it there is no return. I check on the server and it works.

I think the problem is the way i parse the args to the stored procedure.

sybase_query( "call myproc(@iUser='bla', @ipass='passwd'", $resid);

I also try : sybase_query( "'bla', 'passwd'", $resid);

Thank you for your help
Hello Experts,

I have 2 Tables namely AddressTable1 and AddressTable2. Both of them have same number of Columns.

AddressLine1 VARCHAR(55)
AddressLine2 VARCHAR(55)

What I would like to find out is something different here.

A provide(ProviderID) will have entries in both the tables(Only 1 row) and the address of the Provider in both tables may or may not match.

I need a query/proc to find out the Providers those addresses are not matching.

When I say NOT MATCHING, I simply;

do not mean the direct comparison of the fields
do not mean converting them to UPPER case and compre

The addresses may logically be matching. But not physically(actual data in the fields)
E.g:Address.PNGHere, we know that STE and SUITE are same but when you compare them, it will always fail. We can create a crosswalk as one of the functionality to complete this. But there are other scenarios to consider.

The texts in the address fields might be loaded vice-versa. There could be space in between. There could be # instead of No.

The main reason of these data discrepancies is "Manual intervention". The data is loaded into database in 2 different modes.
User Mode: Business Users manually enter the data from a front-end application.
Batch Mode: Inbound data is fed to DB through certain interfaces

We may be able to teach the Business Users to enter the data…
Within a stored procedure, it seems that some "set" directives are ignored by Sybase while others aren't. I'm having trouble understanding why the simple example below displays statistics details, but not the query plan. Am I missing something? Doing something wrong?

1> SELECT @@version
2> go

 Adaptive Server Enterprise/15.7/EBF 22777 SMP SP122 /P/X64/Windows Server/ase157sp12x/3662/64-bit/OPT/Sat Apr 19 01:26:01 2014

(1 row affected)

3>      DECLARE @n int
4>      set statistics io, time, plancost on
5>      set showplan on
7>      SELECT @n=count(*) FROM sysobjects WHERE type='U'
9>      set statistics io, time, plancost off
10>     set showplan off
11> END
12> go

2> go
Total writes for this command: 0

Execution Time 0.
Adaptive Server cpu time: 0 ms.  Adaptive Server elapsed time: 0 ms.
Total writes for this command: 0

Execution Time 0.
Adaptive Server cpu time: 0 ms.  Adaptive Server elapsed time: 0 ms.

==================== Lava Operator Tree ====================

                        (VA = 2)
                        r:1 er:1
                        cpu: 0

            (VA = 1)
            r:1 er:1
            cpu: 0


Open in new window

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 …

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