Solved

Problem with viewing data in SQL Query Analyzer

Posted on 2006-10-31
9
250 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
  • 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
 
LVL 11

Accepted Solution

by:
rw3admin earned 500 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now