SYBASE: Data Type (compared with sqlserver)

Source: Internet
Author: User

Character numeric type:

    • Char, varchar, long varchar
    • Nchar, nvarchar, long nvarchar
    • -Compatible data types are implemented through domains: sysname (varchar (30), text (long varchar domain), ntext (long nvarchar domain), and XML (long varchar domain), uniqueidentifierstr (char (36) field: ing to the uniqueidentifier column of sqlserver)

Unlike Sybase and sqlserver, the storage structure of all character data types is the same. By default, values of up to 128 bytes are stored in a segment. If the full value of values of more than 128 bytes is stored on other pages, only four bytes of addresses pointing to the complete value are saved locally. The default value is controlled by the inline and prefix statements of the create table statement.
Different from Sybase and sqlserver, the length of character data types distinguish between the byte length and the character length. The default value is the byte length.
Unlike Sybase and sqlserver, the char type is in the same behavior as varchar. SQL Anywhere does not fill data with blank characters
When the clientProgramWhen performing describe on a column of the character data type, depending on the program interface used, using the semantic definition of the character length may affect the returned value.

 

Numeric data type:

    • Bigint, bit, decimal, Int, integer, numeric, smallint, tinyint
    • Double, float (P), real
    • Implement data types compatible with sqlserver through domains: Money (Numeric (), smallmoney (Numeric ))

Note: precision, decimal places, and number of digits
Sybase's default bit type cannot be blank, while sqlserver does not.
Sybase specifies that integer types other than bit can be modified with unsigned, while SQL server does not.

 

Bit Array data type:Only data consisting of 0 and 1 can be stored: binary representation of Integers

    • Varbit, bit varying, long varbit, long bit varying

 

Binary data type: Byte comparison without character set Conversion
Binary, long binary, varbinary, binary varying, uniqueidentifier (also known as UUID or GUID)
Implement sqlserver-compatible data types through the domain: image (long binary)
The maximum length of Sybase binary data is different from that of SQL Server binary data: 32767 instead of 80000.
Although the binary type of Sybase is different from that of varbinary, Sybase always treats it as varbinary.

 

Date and Time type:

    • Date, time, timestamp
    • Implement data types compatible with sqlserver through the domain: datetime (timestamp), smalldatetime (timestamp)

The date and time types of Sybase are very different from those of SQL Server. SQL Server has two types: datetime and smalldatetime, and the range and accuracy that can be expressed are small.
The timestamp type in sqlserver is a binary string of the row version, which is different from the timestamp datetime type in Sybase.
In Sybase, whether the interface is in ODBC format, whether it is embedded in SQL format, whether date_order is specified, "yyyy-mm-dd" and "yyyy/mm/DD" formats can always be correctly parsed as dates; "HH: mm: SS: ssss" will be clearly interpreted as time; the combination of the two can always produce a clear date and time; "yyyy-mm-dd hh. mm. SS. SSS can also produce a clear date and time. The period in the time can only be combined with the date !!

 

Domain:Custom Data Type: built-in data type alias, including precision, decimal places, default value, check constraint, null.
The existence of the domain facilitates the consistency of the entire database and can eliminate some type errors.
Sybase's domain definition, usage, functions, and requirements are exactly the same as those of SQL Server.

 

Data type conversion:

    • Cast, convert display conversion; type functions such as date, String, number type + 0.0; implicit conversion
    • Character Set conversion loss and replacement Problems
    • Java and SQL data types are converted according to JDBC standards
    • The conversion of different data types requires careful study and practice. Sybase and sqlserver and different RDBMS systems are not exactly the same.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.