Conversion with CONVERT function for computated value with numbers in list : Convert « 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 » Convert 
Conversion with CONVERT function for computated value with numbers in list

 

7>
8>
9create table Billings (
10>     BankerID           INTEGER,
11>     BillingNumber      INTEGER,
12>     BillingDate        datetime,
13>     BillingTotal       INTEGER,
14>     TermsID            INTEGER,
15>     BillingDueDate     datetime ,
16>     PaymentTotal       INTEGER,
17>     CreditTotal        INTEGER
18>
19);
20> GO
1>
2INSERT INTO Billings VALUES (11'2005-01-22', 1651,'2005-04-22',123,321);
3> GO

(rows affected)
1INSERT INTO Billings VALUES (22'2001-02-21', 1651,'2002-02-22',123,321.);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (33'2003-05-02', 1651,'2005-04-12',123,321);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (44'1999-03-12', 1651,'2005-04-18',123,321);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (55'2000-04-23', 1651,'2005-04-17',123,321);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (66'2001-06-14', 1651,'2005-04-18',123,321);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (77'2002-07-15', 1651,'2005-04-19',123,321);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (88'2003-08-16', 1651,'2005-04-20',123,321);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (99'2004-09-17', 1651,'2005-04-21',123,321);
2> GO

(rows affected)
1INSERT INTO Billings VALUES (00'2005-10-18', 1651,'2005-04-22',123,321);
2> GO

(rows affected)
1>
2>
3SELECT TOP CONVERT(dec(10,2),BillingTotal + PaymentTotal)
4FROM Billings
5> GO

------------
      288.00
      288.00
      288.00

(rows affected)
1>
2>
3>
4>
5> drop table Billings;
6> GO
1>

 
Related examples in the same category
1. CONVERT function syntax: CONVERT(<target data type>, <expression to be converted>, <style>)
2. CONVERT() Function Styles
3. Format money (currency)
4. CONVERT(varchar,Date,101)
5. SELECT CONVERT(VarChar(50), @Num, 2)
6. Combine CONVERT() and DATEADD() to format
7. SELECT CONVERT(VarChar(20), 'April 29, 1988')
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.