Sybase database when migrating to Sql script changes

Removed after the cascade constraints drop statement
For example: drop table tbl1 cascade constraints;

Read: drop table tbl1;

Remove the semicolon between statements
Sybase Sql statement does not allow to end with a semicolon. For example:

Long integer by the number (19) to numeric (19,0); varchar2 to varchar
Serial number used in the primary key with identity tags, and the field of data type can only scale 0 numeric. When a foreign key of a table, the field types to the same example:

Short integer primary key: q_id numeric (5,0) identity not null,

Integer primary key: w_id numeric (10,0) identity not null,

Long integer primary key: e_id numeric (19,0) identity not null,

Must show whether the null field
Allow for empty fields must write null, otherwise the default of the field is not empty.

For example: w_type VARCHAR (40) default -1 null,

INSERT statements for all table names and field names are all built the table by writing the name, case sensitive. Do not give marks for the identity of the primary key assignment, sybase will automatically start from an order by a

Modify hbm
Hbm file has a schema = "public", change the schema = "user name"

Modify the sql statement java
1) top10 statement

In oracle you can use:

select * from (select * from tble order by tt_id desc) where rownum <= 10

Id get tble table top 10 records

In sybase the change:

set rowcount 10 select * from tble order by model_id desc

2) the rounding function

Trunc by the round (to return to the specified number of rounds after a given number of decimal places from the value) alternative. Reference the following information:



1. On the issue since the growth of id, if you need to manually insert the part of the initial data, it should be set on the first identiy_insert

set insert_identity tblname on

And a session can only be set on a table, if there are multiple tables, have to fall off the current, then open the other.

2. Sybase command terminator is a go, so a number of statements in one go after the best plus

3. Use SET ROWCOUNT (similar to the top 10) of the attention, this command take effect immediately and affect the current session, that is, a session with the SET ROWCOUNT affects all queries, the solution: in which statement added SET ROWCOUNT 0 remove this restriction


select * from fnms_param_infor


4. Adjust the character set

(1) character set the server to adjust all of the Server requirements nocase the utf8, please click the following manner:
Among the options in the config server language> default character / sort and then save and restart the service. May not be successful, but reboot the machine on it.
(2) to adjust the client character set the client character to cp936

分类:Database 时间:2010-02-08 人气:247
blog comments powered by Disqus


iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 闽ICP备15018612号

processed in 0.280 (s). 10 q(s)