sybase-ase

How do I look at column metadata in Sybase?

六眼飞鱼酱① 提交于 2019-12-01 02:02:08
问题 I have a list of columns a co-worker has given to me, but these columns reside in different tables in the DB. Is there some kind of tool in Sybase where I can query the table a column belongs to? (I've tried Google-ing for this kind of tool, but no luck so far) 回答1: syscolumns holds column metadata. select * from syscolumns where name = ; The id column in syscolumns is the id of the column's table, in sysobjects; select b.name as tablename, a.name as columnname from syscolumns a join

How can I use Dapper's strongly-typed query parameters with Sybase ASE?

醉酒当歌 提交于 2019-11-30 21:13:05
Dapper can pass query parameters as anonymous objects, and supports any ADO.NET data provider. However, when running the following query against the Sybase 15 ADO.NET drivers: using (var connection = new AseConnection("...")) { connection.Open(); var results = connection.Query<Foo>( "dbo.sp_columns", new { table_name = "dbo.sysusers"}, commandType: CommandType.StoredProcedure); } ... the following error is thrown: Sybase.Data.AseClient.AseException: Procedure sp_columns expects parameter @table_name, which was not supplied. at Sybase.Data.AseClient.AseCommand.ᜁ(Int32 A_0) at Sybase.Data

How to backup and restore sybase database tables using command line [closed]

一曲冷凌霜 提交于 2019-11-30 09:58:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How can I backup my sybase tables and restore using command line? please help me with the command using bcp I have tried using sybase central GUI Thanks. 回答1: Since you didn't specify whether you are running on Windows or Unix I'll try to cover both. Unix bcp is located in $SYBASE/$SYBASE_OCS/bin/ Windows bcp is

How to backup and restore sybase database tables using command line [closed]

十年热恋 提交于 2019-11-29 18:02:35
How can I backup my sybase tables and restore using command line? please help me with the command using bcp I have tried using sybase central GUI Thanks. Michael Gardner Since you didn't specify whether you are running on Windows or Unix I'll try to cover both. Unix bcp is located in $SYBASE/$SYBASE_OCS/bin/ Windows bcp is located in %SYBASE%\%SYBASE_OCS%\bin Export bcp DB_NAME..TABLE_NAME out TABLE_NAME.bcp -Sservername -Uusername -Ppassword -[c or n] Choose either -c or -n depending if you want the file to be human readable or not. I recommend using -n unless you have a compelling need to

Does Sybase ASE 12.5 support Common Table Expressions?

久未见 提交于 2019-11-29 08:01:17
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? 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 ) SELECT Folders_Id FROM Sales_CTE is the same as this: SELECT aux.Folders_Id FROM (SELECT Folders_Id FROM Folders)

Sybase JConnect: ENABLE_BULK_LOAD usage

我怕爱的太早我们不能终老 提交于 2019-11-29 02:39:58
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. 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 yield up to 22K insertions a second in a perfect world (as per Sybase anyway). SybDriver sybDriver = (SybDriver

How can I get data from a stored procedure into a temp table?

試著忘記壹切 提交于 2019-11-28 23:28:06
Am working on sybase ASE 15. Looking for something like this Select * into #tmp exec my_stp; my_stp returns 10 data rows with two columns in each row. In ASE 15 I believe you can use functions, but they're not going to help with multirow datasets. If your stored proc is returning data with a "select col1,col2 from somewhere" then there's no way of grabbing that data, it just flows back to the client. What you can do is insert the data directly into the temp table. This can be a little tricky as if you create the temp table within the sproc it is deleted once the sproc finishes running and you

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

强颜欢笑 提交于 2019-11-28 21:33:23
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 name = 'a_table' AND type = 'U' ) CREATE TABLE a_table ( col1 int not null, col2 int null ) GO Running

Extract SP and DDL Scripts in sybase Server

自闭症网瘾萝莉.ら 提交于 2019-11-28 11:08:31
问题 How do I extract DDL, Stored Procedures (SP) and other database scripts from Sybase ASE. 回答1: Look into the ddlgen utility included with sybase, ususally found in the Sybase Central directory, or the $SYBASE/ASEP/bin. This should be able to generate scripts to create all of the database objects including user-defined datatypes (UDD), indexes, stored procedures, etc. 回答2: You can use sp_helptext to show the DDL. 来源: https://stackoverflow.com/questions/15081975/extract-sp-and-ddl-scripts-in

how to specify row delimiter when using bcp with a format file

半世苍凉 提交于 2019-11-28 10:31:27
问题 I am using bcp utility to import data into Sybase database on Solaris system Since the bcp file is generated by another xml parsing script, I have no control on that to make it generate the fields in the order I want. And now the the order of fields in the bcp file is a little different with the order in the database table. I want to use a format file for bcp tool to control the order of fields loaded into the database, so I have the sample bcp file as below and constructed a format file