| |

VerySource

 Forgot password?
 Register
Search
View: 809|Reply: 3

How to use decimal statement to determine the number of decimal places and the number of integers when building a table

[Copy link]

6

Threads

11

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-2-19 11:30:01
| Show all posts |Read mode
How to use decimal statement to determine the number of decimal places and the number of integers when building a table
Reply

Use magic Report

0

Threads

14

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-4-25 18:15:01
| Show all posts
CREATE TABLE [dbo]. [Tab1] (
[a] [int] NULL,
[b] [decimal] (10, 2) NULL
) ON [PRIMARY]
GO
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 China

Post time: 2020-4-25 22:15:01
| Show all posts
decimal and numeric
A numeric data type with fixed-point precision and decimal places.

decimal [(p [, s])] and numeric [(p [, s])]

Fixed-point precision and decimal places. With maximum precision, valid values ​​range from-10 ^ 38 +1 to 10 ^ 38-1. SQL-92 synonyms for decimal are dec and dec (p, s).

p (accuracy)

Specify the maximum number of decimal digits that can be stored to the left and right of the decimal point. The precision must be a value from 1 to the maximum precision. The maximum accuracy is 38.

s (number of decimal places)

Specify the maximum number of decimal digits that can be stored to the right of the decimal point. The number of decimal places must be a value from 0 to p. The default number of decimal places is 0, so 0 <= s <= p. The maximum storage size varies based on accuracy.
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-26 06:30:01
| Show all posts
Create a new table in the Enterprise Manager, enter the field name, select the data type as decimal, in the "Columns" tab below, enter "2" for "Decimal Places", "Accuracy" does not need to change or change according to your needs Too.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list