Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - SQL integers converted to decimals
SQL integers converted to decimals

1. First open the SQL Server database, and then prepare a number.

2. Then you can use the round function to process decimals, but round will turn the end of the decimal into 0 instead of the true number of reserved digits.

3. Next, you can perform decimal conversion through the cast function.

4. However, when using cast, you need to pay attention to avoid overflow of digits in the type of conversion.

5. When performing conversion, write the conversion type as large as possible.

6. Finally, conversion can be performed through the Convert function.

Extended information

SQL data types include the following:

1. Binary data type.

Binary data includes Binary, Varbinary and Image

Binary data type can be either fixed length (Binary) or variable length.

Binary[(n)] is n-bit fixed binary data. Among them, the value range of n is from 1 to 8000. The size of its storage space is n + 4 bytes.

Varbinary[(n)] is n-bit variable-length binary data. Among them, the value range of n is from 1 to 8000. The size of its storage space is n + 4 bytes, not n bytes.

2. Character data type.

Character data types include char, varchar and text.

Character data is data consisting of any combination of letters, symbols, and numbers.

varchar is variable-length character data, its length does not exceed 8kb. char is fixed-length character data with a maximum length of 8kb. ASCII data exceeding 8kb can be stored using the text data type.

3. Unicode data type.

Unicode data types include nchar, nvarchar and ntext.

In Microsoft SQL Server, traditional non-Unicode data types allow the use of characters defined by a specific character set. During installation of SQL Server, character set selection is allowed.

In the Unicode standard, all characters defined by various character sets are included. Using Unicode data types takes up twice as much space as using non-Unicode data types.