Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem with viewing data in SQL Query Analyzer

Posted on 2006-10-31
9
Medium Priority
?
256 Views
Last Modified: 2012-06-27
Hi all,

I have a column type 'real' and it looks fine in the table when I view it in SQL Server Enterprise Manager, but when I pull it up as part of a query in Query Analyzer, the amount of digits is much larger after the decimal point than the original number stored in the table. I didn't do anything special to the column other than call it in the query.


For instance:

Enterprise manager                   Query Analyzer
=============            ================
745.590                                        745.59003


do I have to do anything special when I run a query to get it to look like it does in Enterprise Manager? I want to export the query to a text file, but am afraid that the output would contain the extra digits.

Thanks!
Kittrick


 
0
Comment
Question by:Kittrick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 11

Expert Comment

by:rw3admin
ID: 17846559
AHA
0
 
LVL 4

Author Comment

by:Kittrick
ID: 17846568
aha?
0
 
LVL 11

Expert Comment

by:rw3admin
ID: 17846576
Sorry... I just wanted to say Aha before Acperkins beat me to this one as well, now atleast I have something submitted before him
your enterprise manager is rounding up the value and 745.59003 is the correct value.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Accepted Solution

by:
rw3admin earned 2000 total points
ID: 17846632
again I apologize I was just silly, for last 8 or 10 questions Anthony (acperkins) is beating everyone with an answer and I just jumped on this one... just for that you dont have to give me any points ...
EM will put its own formating in its grid for example a date will appear as '10/4/2000 4:38:43' but the actual date in QA is 2004-10-04 04:38:43.560 ....  so go with the data thats reported in QA, once you export this you will see the correct values in your data export as well


I will let some other expert take care of this.

rw3admin
0
 
LVL 4

Author Comment

by:Kittrick
ID: 17846645
Yeah, that acperkins is quite fast. What I have in Enterprise Manager was imported from Access, so this is the number I need but it was automatically imported with the type 'real'. What should I do to get it to look like Enterprise Manager?
0
 
LVL 4

Author Comment

by:Kittrick
ID: 17846659
No, you answered my question, I'll give you the points. Thank you very much!
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17846660
>>do I have to do anything special when I run a query to get it to look like it does in Enterprise Manager?<<
Yes.  Replace all real (and float for that matter) columns with fixed length numeric columns.  Real (and float) are approximate data types are should IMHO never be used (unless you are into astronomy need large values and don't care if you are off by a couple of miles).
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17846670
Real is analogous the the double data type that you have used in MS Access and VB.  It is based on IEEE format and is at best approximate.
0
 
LVL 10

Expert Comment

by:AaronAbend
ID: 17846863
I agree - we need to pour some glue on ac's keyboard - he snapped 1000 points from right underneath me in 2 minutes... nice to know I'm not the only one left in the dust!
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question