[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

right align numbers in table / view

Posted on 2008-10-14
5
Medium Priority
?
561 Views
Last Modified: 2010-07-27
ok, newbie question ...

using SS v2005. When I open a table or a view the numerical fields are left aligned? I would have thought they should be right aligned by default ? i.e. like in Access 2003/2007?

how do I right align numbers in a table or view
0
Comment
Question by:LukeB
[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
  • 2
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
Maxi84 earned 1000 total points
ID: 22718522
I don't believe there's any way to right-align numerical data in Management Studio / Query Analyzer.  Previous versions of MS Dynamics AX (Axapta)  right-aligned fields by padding the data with leading spaces, but this was a BAD idea, and fortunately discontinued when version 4.0 was released.  Text alignment and formatting is something that should be done in the presentation layer ONLY.
0
 
LVL 23

Expert Comment

by:adathelad
ID: 22718662
I'd echo what Maxi84 said, and I'd have to question why it's an issue? But to offer a workaround, you could just copy/export the results into Excel.
0
 
LVL 1

Author Comment

by:LukeB
ID: 22718868
thanks Maxi, most of the times the data will be presented in views to a Front End or report.

Adathelad, well I would think that is obvoius, because it is easier for the human eye to look at numbers right justfied :

171.105
151.231
120.503
122.91
119.359
132.279
27.04
118.272
109.75
111.85
101.621
95
5.5021
100.248
97.1796
109.87
28.889

Access and Excel do by default, so part of the Microsoft crowd agrees with me!
0
 
LVL 23

Expert Comment

by:adathelad
ID: 22718918
You misunderstood my point (or rather I didn't answer clearly enough!) - I totally agree with numbers justified to the right being easier to read + being the standard alignment and wasn't querying the point of that aspect. It does beg the question, why doesn't MS implement the same in SQL Server as (e.g. Excel, Access) as you asked....my point was was more based on the fact that OK, it would be nice/ideal if it did align to the right, but the whole point of SSMS/Query Analyser isn't as an end-user day to day UI that will display things in pretty/customised fashion - i.e. was trying to identify if you're using it for that purpose, when you should be doing this in the presentation layer. If the display/formatting like this in SQL Server was an issue, it comes across as if you're using it for some end-user purpose.

Not sure if I've clarified my response, or muddied the water further still!
0
 
LVL 1

Author Comment

by:LukeB
ID: 22723061
hi adathelad

no problem..
no, not 'really' using for presentation viewing, sorry I should have been clearer. I say not 'really' for I mysefl being the developer do look at a table more often in the SSMS/QA (to wit, if they supply a viewer why not look at the data?) and it is not easy to look at some data that way, espeicailly the real example I gave.

Less so, I have some advanced users that will be using the SSMS/QA to do ad hoc queries, again, to look at the data rather than thru the front end. But they won't be looking at the data that way day-to-day and will be even more reason for me nattering at them 'don't open tables directly, use a query view in SSMS/QA or the Front End or do a query in the FE.

thanks, i'm a newbie with SQLServer and was surprised at this.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

656 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