C # and SQL type,

Source: Internet
Author: User

C # and SQL type,

Type System Type Number of digits Bytes SQL type Description
Bool System. Boolean 1 bit   (Bit) 0 to 1
Byte System. Byte 8 bit 1 byte (Tinyint) 0 to 255
Char System. Char 8 bit 1 byte    
Short System. Int16 16bit 2 byte (Smallint) -2 ^ 15 (-32,768) to 2 ^ 15-1 (32,767)
Int System. Int32 32bit 4 byte (Int) -2 ^ 31 (-2,147,483,648) to 2 ^ 31-1 (2,147,483,647)
Float System. Single 32bit 4 byte (Real) 1-bit sign bit, 8-bit index bit, 23bit tail number,-2 ^ 128 ~ + 2 ^ 128 same as-3.40E + 38 ~ + 3.40E + 38 7-digit valid numbers
Long System. Int64 64bit 8 byte (Bigint)  
  System. DateTime 64bit 8 byte (Smalldatetime, datetime)  
        (Datetime) The date and time of January 1, 3%, accurate to 3.33 seconds (or milliseconds)
        (Smalldatetime) Date and Time data from January 1, January 1-20, 1900 to January 1, June 6, accurate to minutes
Double System. Double 64bit 8 byte (Float)

1-bit sign bit, 11-bit index bit, 52bit tail digit, 15-bit valid floating point Precision digit from ± 5. 0E − 324 to ± 1. 79E + 308

Decimal System. Decimal 128bit 16 bytes (Decimal, momey, numeric, smallmoney) ± 1. 0E −28 to ± 7. 9E28 28-bit valid number
        (Decimal, numeric) -10 ^ 38 + 1 to 10 ^ 38-1
        (Money) -2 ^ 63 (-922,337,203,685,477.5808) and 2 ^ 63-1 (+ 922,337,203,685,477.5807)
        (Smallmoney) -Between 214,748.3648 and + 214,748.3647, accurate to 10 thousandth of the currency unit
  System. Guid 128bit 16 bytes (Uniqueidentifier)  
Byte [] System. Byte []     (Binary, image, timestamp, varbinary)  
        (Binary) A fixed-length binary data. Its maximum length is 8,000 bytes.
        (Varbinary) A variable-length binary data. Its maximum length is 8,000 bytes.
        (Image) Variable-length binary data. The maximum length is 2 ^ 31-1 (2,147,483,647) bytes.
        (Timestamp) The unique number in the database range, which is also updated each time the row is updated.
String System. String    

(Char, nchar, text, ntext, varchar, nvarchar, xml)

 
        (Char) Non-Unicode character data with a fixed length, 1 character and 1 byte. If the length is insufficient, it is automatically filled in.
        (Nchar) 1 character occupies 2 bytes, and the data length is left blank
        (Varchar) Variable-length non-Unicode data, up to 8,000 characters
        (Nvarchar) Unicode data with a variable length. The maximum length is 4,000 characters.
        (Text) Variable-length non-Unicode data. The maximum length is 2 ^ 31-1 (2,147,483,647) characters. 1 character occupies 1 byte, and the maximum length is 2 GB.
        (Ntext) Unicode data with a variable length. The maximum length is 2 ^ 30-1 (1,073,741,823) characters.
Object System. Object     (SQL _variant)  

Related Article

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.