This is a discussion on Some Queries within the SQL Server forums, part of the Microsoft SQL Server category; --> 1. In SQL Server 2000, even after using round function upto 2 decimals, the operation over a float field ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 1. In SQL Server 2000, even after using round function upto 2 decimals, the operation over a float field gives results upto 16 decimal places. How can we avaoid this? Is it possible to display such results upto 2 decimal places in Query Analyzer? What are the related settings and where to do it? 2. My table 1 has 3 fields, table 2 has 5 fields. Both tables have same records and a common field. I want table 3 which will contain fields from both the tables and the common field. How to achieve this? |
| |||
| 1. In SQL Server 2000, even after using round function upto 2 decimals, the operation over a float field gives results upto 16 decimal places. How can we avaoid this? Is it possible to display such results upto 2 decimal places in Query Analyzer? What are the related settings and where to do it? Look for Convert function in BOL 2. My table 1 has 3 fields, table 2 has 5 fields. Both tables have same records and a common field. I want table 3 which will contain fields from both the tables and the common field. How to achieve this? Try this Select * into Table3 from (Select T1.*, T2.field4, T2.Field5 from Table1 T1, Table2 T2 where T1.CommonField=T2.CommonField) T Madhivanan |
| ||||
| Sameer (sameer75@gmail.com) writes: > In SQL Server 2000, even after using round function upto 2 decimals, > the operation over a float field gives results upto 16 decimal places. > How can we avaoid this? Is it possible to display such results upto 2 > decimal places in Query Analyzer? What are the related settings and > where to do it? A float is an approxamite value, and is only exact by chance. A value like 2.34 cannot be represented exactly in a float. If you only want to see a certain number of decimals, use the decimal data type. Decimal are exact numbers. > 2. > My table 1 has 3 fields, table 2 has 5 fields. > Both tables have same records and a common field. > I want table 3 which will contain fields from both the tables and the > common field. How to achieve this? Please post: o CREATE TABLE statements for your tables. o INSERT statement with sample data. o The expected result given that sample. The above sounds too strange to me, for wanting to try a guess. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |