What is a Sybase datatype? |
|
Each column in a table has to have a specific datatype for its values. A datatype is simply a kind of information: text, numbers, and so on. Using datatypes allows Sybase SQL Server to sort your information, perform calculations on your data, and to search through your data successfully. Here are some examples of datatypes.
| Datatype | Description | Examples |
| text | Any kind of text, up to 2 Gigabytes in size | Name, address, phone number |
| integer | Non-decimal numbers | number of things sold |
| char(x) | A fixed length character string. x is the length of the string. | Phone number, social security number |
| varchar(x) | A variable length character string that can be no longer than x | A person's first name |
| image | A computer graphic | A gif or a jpeg |
| money | Monetary values | price, cost, salary |
| decimal | Numbers with decimals | interest rate, percent change |
Don't put phone numbers in an integer field. The hyphen will be understood as a minus sign. Instead of getting 555-0567, you will get 555 minus 567, or -12, which is a hard number to dial. The same holds true for Social Security numbers, and any other number that includes non-numeric data.
If your data doesn't quite fit any of these types, see the SQL server documentation on datatypes.