Solved

Problem with viewing data in SQL Query Analyzer

Posted on 2006-10-31
9
249 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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

747 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

12 Experts available now in Live!

Get 1:1 Help Now