decimal(15,4) : decimal « Data Type « SQL Server / T-SQL

SQL Server / T-SQL
1. Aggregate Functions
2. Analytical Functions
3. Constraints
4. Cursor
5. Data Set
6. Data Type
7. Database
8. Date Timezone
9. Index
10. Insert Delete Update
11. Math Functions
12. Select Query
13. Sequence
14. Store Procedure Function
15. String Functions
16. Subquery
17. System
18. Table
19. Table Joins
20. Transact SQL
21. Transaction
22. Trigger
23. View
24. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
SQL Server / T-SQL » Data Type » decimal 
decimal(15,4)


15>
16> SET NOCOUNT ON
17> DECLARE @float1 float, @float2 float, @float3 float, @float4 float
18> DECLARE @dec1 decimal(15,4), @dec2 decimal(15,4),
19>         @dec3 decimal(15,4), @dec4 decimal(15,4)
20> DECLARE @pointseven decimal(15,4)
21> SET @float1 = 7
22> SET @float2 = 100
23> SET @float3 = .0009
24> SET @float4 = @float1/@float2 - @float3
25> SET @dec1 = 7
26> SET @dec2 = 100
27> SET @dec3 = .0009
28> SET @dec4 = @dec1/@dec2 - @dec3
29> SET @pointseven = .7
30SELECT @float4 '@float4', @float3 '@float3',
31>        @pointseven - @float4 'float diff'
32SELECT @dec4 '@dec4', @dec3 '@dec3',
33>        @pointseven - @dec4 'dec diff'
34>
35> GO
@float4                  @float3                  float diff
------------------------ ------------------------ ------------------------
   6.9100000000000009E-2    8.9999999999999998E-4      0.63089999999999991
@dec4             @dec3             dec diff
----------------- ----------------- ------------------
            .0691             .0009              .6309
1>
           
       
Related examples in the same category
1. Use select to do the calculation
2. Function returning decimal
3. Cast int to decimal
4. Cast real number to decimal
5. Cast decimal to varchar and append another string
6. Average of decimal values
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.