sybase-ase

From a Sybase Database, how I can get table description ( field names and types)?

爷,独闯天下 提交于 2019-11-28 03:16:28
I have access to command line isql and I like to get Meta-Data of all the tables of a given database, possibly in a formatted file. How I can achieve that? Thanks. Lukasz Lysik Check sysobjects and syscolumns tables. Here is a diagram of Sybase system tables. List of all user tables: SELECT * FROM sysobjects WHERE type = 'U' You can change 'U' to other objects: C – computed column D – default F – SQLJ function L – log N – partition condition P – Transact-SQL or SQLJ procedure PR – prepare objects (created by Dynamic SQL) R – rule RI – referential constraint S – system table TR – trigger U –

Does Sybase ASE 12.5 support Common Table Expressions?

岁酱吖の 提交于 2019-11-28 01:47:33
问题 I noted that Sybase SQL Anywhere supports them, but can't find any documentation on ASE also doing so. If it doesn't, what would be my best option for designing a recursive query? In SQL Server 2008 I'd do it with a CTE, but if that's not available? A function perhaps? 回答1: Sybase ASE 12.5 (and also 15.0) doesn't support CTE. You can use a inner query to solve your problem. A simple CTE like this: WITH Sales_CTE (Folders_Id) AS -- Define the CTE query. ( SELECT Folders_Id FROM Folders )

Sybase JConnect: ENABLE_BULK_LOAD usage

白昼怎懂夜的黑 提交于 2019-11-27 21:57:16
问题 Can anyone out there provide an example of bulk inserts via JConnect (with ENABLE_BULK_LOAD ) to Sybase ASE? I've scoured the internet and found nothing. 回答1: I got in touch with one of the engineers at Sybase and they provided me a code sample. So, I get to answer my own question. Basically here is a rundown, as the code sample is pretty large... This assumes a lot of pre initialized variables, but otherwise it would be a few hundred lines. Anyone interested should get the idea. This can

How do I conditionally create a table in Sybase (TSQL)?

只愿长相守 提交于 2019-11-27 13:55:49
问题 OK, so Sybase (12.5.4) will let me do the following to DROP a table if it already exists: IF EXISTS ( SELECT 1 FROM sysobjects WHERE name = 'a_table' AND type = 'U' ) DROP TABLE a_table GO But if I try to do the same with table creation, I always get warned that the table already exists, because it went ahead and tried to create my table and ignored the conditional statement. Just try running the following statement twice, you'll see what I mean: IF NOT EXISTS ( SELECT 1 FROM sysobjects WHERE

How to pass a comma separated list to a stored procedure?

丶灬走出姿态 提交于 2019-11-27 03:10:10
问题 So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause: CREATE PROCEDURE getSomething @keyList varchar(4096) AS SELECT * FROM mytbl WHERE name IN (@keyList) How do I call my stored proc with more than 1 value in the list? So far I've tried exec getSomething 'John' -- works but only 1 value exec getSomething 'John','Tom' -- doesn't work - expects two variables exec getSomething "'John','Tom'" -- doesn't work -