sybase

How do I select from a stored procedure in Sybase?

My DBA has constructed me a stored procedure in a Sybase database, for which I don't have the definition. If I run it, it returns a resultset with a set of columns and values. I would like to SELECT further to reduce the rows in the result set. Is this possible? From this question it seems like I could insert the results into a temporar...

Running Sybase SQL commands from DOS/Windows batch file

Is there any way I can run Sybase SQL commands from command prompt. I need to write a batch file which runs an SQL query on machine as a fix for a bug. ...

SQL string replacement workaround

I'm working in a modified version of Sybase 10 that doesn't have the stuff, replace or str_replace functions. I need to replace part of string in a number of records. Are there any creative ways to program around this, so I don't have to do them all manually? Example: UPDATE status SET description = replace(description,'abc','def') W...

Does the order of columns on a covered index in Sybase affect select performance?

We have a large table, with several indices (say, I1-I5). The usage pattern is as follows: Application A: all select queries 100% use indices I1-I4 (assume that they are designed well enough that they will never use I5). Application B: has only one select query (fairly frequently run), which contains 6 fields and for which a fifth ind...

Does having several indices all starting with the same columns negatively affect Sybase optimizer speed or accuracy?

We have a table with, say, 5 indices (one clustered). Question: will it somehow negatively affect optimizer performance - either speed or accuracy of index picks - if all 5 indices start with the same exact field? (all other things being equal). It was suggested by someone at the company that it may have detrimental effect on performa...

Sybase: Does the column order in a non-clustered index affect insert performance?

To be more specific (since the general answer to the subject is likely "yes"): We have a table with lots of data in Sybase. One of the columns is "date of insertion" (DATE, datetime type). The clustered index on the table starts with the "DATE". Question: For another, non-clustered index, does the order of columns (more specifically...

how to model this database relationship? (sybase powerdesigner)

I'm doing a conceptual model in Sybase PowerDesigner. The restriction is following: One doctor can work in only one office at a time during his working time (shift). I guess Doctor - Office relationship should be many-many, but what about time restriction ("during his working time")? Should it be a new table SHIFT? So I guess I shoul...

How I can find the list of Sybase Indexes for a given database?

How I can find the list of Indexes for a given database in Sybase? ...

How do I implement this algorithm in SQL?

I am trying to implement an algorithm in SQL (transact sql) and finding it difficult given my current abilities. I have tried to strip the problem down to the esstentials. The basic idea behind this algorithm is that a user is planning out their budget for lets say a month. They have a good idea of both how much and when money is coming ...

Using Sybase ASE 12.5.4 with jTDS drivers with JRuby

Problem I am trying to build a small ruby script - which will be run using jruby once a day - to connect to a Sybase ASE 12.5.4 database and perform a complex query. Ultimately I intend to do some processing on the data and insert the new data in a MySQL table for use within a rails application. Environment jruby v1.4.0 java v1.6.0...

Sybase SQL Anywhere Database Management Tools

What tools can I use to monitor performance, defragment, etc. a Sybase SQL Anywhere database? ...

Using ADO.NET to access Sybase database

I have three stored procedures that I can use to retrieve data from Sybase database. Two of these three stored procedures have output parameters. These two stored procedures do not process and return values in the output parameters. The code for the stored procedure that executes properly by returning values in a datareader is as follows...

Selecting rows between x and y from database

I've got a query which returns 30 rows. I'm writing code that will paginate those 30 rows into 5 records per page via an AJAX call. Is there any reason to return just those 5 records up the presentation layer? Would there be any benefits in terms of speed or does it just get all the rows under the hood anyways? If so, how do I actually...

How to get mysql to accept sybase database..table notation

I'm porting a sybase application to mysql and of course there's tons of sql compatibility issues, but one that I don't see an easy way out of without changing every single sql is that in sybase you can refer to a table by db..table notation, but in mysql it requires db.table. I'm kinda on mysql's side on this one, but this is what it is....

JRruby, Sybase JDBC and DBI - fetching column name with the AS clause issue

I have a ruby script which I run using the JRuby Interpreter. The script connects to a Sybase database using DBI and Sybase JDBC (jTDS3.jar and jconn3.jar) My problem is that I have a select query that alters the column names of table. For example: SELECT t.TRANSACTION as 'business_transaction', t.TRADE_CURRENCY as 'currency', t.CURREN...

Sql server reporting services connected to SQL Anywhere database (ASA or ASE)

Nube question: Is there any way to connect Sql server 2008 reporting services to a sybase SQL Anywhere database (ASA or ASE)? (Maybe ODBC ...) If so, have you done it? kindly share experiences and any notable considerations. thanks ...

insert now() into a Sybase timestamp field

I'm new to sybase and google was anything but helpful. All I want to do is insert a valid time for "right now" into a timestamp field. The mysql equivalent is now(). I tried getdate() and got funny results. Thanks. ...

Sybase 15 performance issue

I am working with Sybase 15 in my application and there is performance issue related with nested joins. I have stored procedure which selects 2 columns from 2 tables and compares equalities of over 10 columns between this 2 tables. But when I run this stor. proc., the result takes 40 minutes. I added "set merge-join off" statement to top...

Grab SQL being executed in a shell script

Given a shell script containing a bunch of SQL statements, is there an option to redirect just the SQL statements to stdout/file? The structure of the script is something like this: ... for i in *list* do isql *credentials etc* <<EOF > a.out select *about 100 cols* from $i + "_TAB" go EOF done ... Query has been...

Determining if a user is a member of a database without using dbname..sysusers

This is probably an impossible question, but sp_lock calls object_name(object_id, dbid) but where a user is not a member of that database, it throws a string of errors. Those errors stop client program (a python script) from receiving the output of sp_lock @verbose=1 In what manner could I detect if I were a member of dbname, without h...