sybase

What is the mysterious 'timestamp' datatype in Sybase?

可紊 提交于 2019-11-27 05:15:52
I recently discovered a table in our Sybase database at work that uses a column of a type 'timestamp'. If I create a table using this mysterious timestamp datatype like this create table dropme ( foo timestamp, roo int null ) insert into dropme (roo) values(123) insert into dropme (roo) values(122) insert into dropme (roo) values(121) select * from dropme go I get the following from 'select * from dropme': foo roo -------------------- ----------- 0x000100000e1ce4ea 123 0x000100000e1ce4ed 122 0x000100000e1ce509 121 0x000100000e1ce4ea does not look very timestampy to me. Also, I see this output

How to convert a string to a date in sybase

纵然是瞬间 提交于 2019-11-27 01:02:24
问题 I need to specify a date value in a sybase where clause. For example: select * from data where dateVal < [THE DATE] 回答1: Use the convert function, for example: select * from data where dateVal < convert(datetime, '01/01/2008', 103) Where the convert style (103) determines the date format to use. 回答2: Here's a good reference on the different formatting you can use with regard to the date: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc38151.1510/html/iqrefbb/Convert

Sybase offset for pagination

浪尽此生 提交于 2019-11-26 23:23:44
问题 Is there any simple way to implement pagination in sybase? In postgres there are limit and offset in mysql there is limit X,Y. What about sybase? There is top clausure to limit results but to achieve full pagination there is also offset needed. It is not a problem if there are a few pags, I can simply trim results on the client side, but if there are millions of rows I would like to fetch only data that I need. 回答1: Quoting from http://www.isug.com/Sybase_FAQ/ASE/section6.2.html#6.2.12:

SYBASE扩充日志段空间

牧云@^-^@ 提交于 2019-11-26 21:18:10
有时候日志段空间满了使用下列语句也无济于事,又不能直接重启库,就加空间应急, dump tran QAS with truncate_only dump tran QAS with no_log sp_helpdevice go sp_helpdb QAS go sp_helpsegment logsegment go 声明设备 use master DISK INIT name = 'QAS_data_004', physname = 'E:\sybase\QAS\sapdata_1\QAS_data_004.dat', size = '100G', directio = true go DISK INIT name = 'QAS_log_004', physname = 'E:\sybase\QAS\saplog_1\QAS_log_004.dat', size = '20G', directio = true go 更改数据库 ALTER DATABASE QAS ON QAS_data_004 = '50G' LOG ON QAS_log_004 = '20G' go 来源: https://www.cnblogs.com/weikui/p/11333634.html

Performance of different approaches to time-based data

让人想犯罪 __ 提交于 2019-11-26 20:05:12
问题 I'm asking this in the context of PerformanceDBA's claim in this answer to another question that this query: SELECT ProductId, Description FROM Product p, ProductStatus ps WHERE p.ProductId = ps.ProductId -- Join AND StatusCode = 2 -- Request AND DateTime = ( -- Current Status on the left ... SELECT MAX(DateTime) -- Current Status row for outer Product FROM ProductStatus ps_inner WHERE p.ProductId = ps_inner.ProductId ) using a ProductStatus table that holds only an effective (start) date for

[ Database ] [ Sybase ] [ SQLServer ] sybase 與SQL Server的界接方式

时光怂恿深爱的人放手 提交于 2019-11-26 18:22:34
目前我們有個專案Server A安裝了 SQL Server 2012,有個需求需要連線到另外一台Server B上的 Sybase 12.5的view, 先前試過了很多方法都無法連通。主要的原因是因為SQL Server 2012 是只有 64bit 版本, Sybase 12.5 的所有的driver ( ODBC, OLEDB 等) 都只有32 bit 的版本,所以就算Test connection 連線到測通了了, 也會有後續一堆很奇怪的Exception。 最後的解決方法如下: 1. 在Server B 上安裝SQL2005EXPRESS ( 沒有軟體授權費用的考量 ),透過同台Sever 32 bit 的ODBC連線去設定DB Link 文章參考: 如何在 SQL 2005 Express 中設定連結的伺服器(Linked Server) http://blog.miniasp.com/post/2008/07/30/How-to-setup-Linked-Server-in-SQL-Server-2005.aspx 2. 在Server A 上的 SQL Server 2012 建立一個連線連回Server B 上安裝SQL2005EXPRESS 基本上,依照上述的步驟,就可以完成32bit與64bit的異質資料庫的界接,有個麻煩的一點是畢竟是異質資料庫

Why SQL Server DATETIME type saves time in ticks of 1/300 of a sec?

风流意气都作罢 提交于 2019-11-26 17:06:45
问题 SQLServer datetime format is stored as 8 bytes where the first four bytes are number of days since Jan 1, 1900 and the other four bytes are number of ticks since midnight. And the tick is 1/300 of the second. I'm wondering why is that? Where is that 1/300 came from? There must be some historic reason for that. 回答1: Yes, there is a historical reason: UNIX ! For details, read this excelent article by Joe Celko. Here is the detail you're looking for: Temporal data in T-SQL used to be a prisoner

Null resultsets when calling Sybase stored procedure through JDBC

帅比萌擦擦* 提交于 2019-11-26 11:37:26
问题 I\'m calling a Sybase stored procedure that returns multiple resultsets through JDBC. I need to get a specific result set that has a column named \"Result\" This is my code : CallableStatement cs = conn.prepareCall(sqlCall); cs.registerOutParameter(1, Types.VARCHAR); cs.execute(); ResultSet rs=null; int count = 1; boolean flag = true; while (count < 20000 && flag == true) { cs.getMoreResults(); rs = cs.getResultSet(); if (rs != null) { ResultSetMetaData resultSetMetaData = rs.getMetaData();

Cannot insert explicit value for identity column in table &#39;table&#39; when IDENTITY_INSERT is set to OFF

删除回忆录丶 提交于 2019-11-25 23:40:13
问题 I have the below error when I execute the following script. What is the error about, and how it can be resolved? Insert table(OperationID,OpDescription,FilterID) values (20,\'Hierachy Update\',1) Error: Server: Msg 544, Level 16, State 1, Line 1 Cannot insert explicit value for identity column in table \'table\' when IDENTITY_INSERT is set to OFF. 回答1: You're inserting values for OperationId that is an identity column. You can turn on identity insert on the table like this so that you can