Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to format data extracted from query?

Author  Topic 

exorbitant
Starting Member

17 Posts

Posted - 2008-12-23 : 05:21:20
Hi all,

I am trying to format data extracted from query. my query is something like this

select column1 + column2 as data from table1

I want some spaces between both of the columns but it should be aligned. mean if i define some spaces in query like this:
select column1 + ' ' + cloumn2 as data from table1

then the result is not aligned and result of query is like this:

1 Name1
2 Name2
10 Name3
110 Name4
1110 Name5

but i want something like this

1 Name1
2 Name2
10 Name3
110 Name4
1110 Name5

how can i do this?
thanks in advance...

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-12-23 : 05:51:56
Are you formatting in SQL Server Query window or somewhere else like a webpage etc?
Go to Top of Page

exorbitant
Starting Member

17 Posts

Posted - 2008-12-23 : 06:07:33
hi
i don't know why the text in my post is not displaying well. i want records like this

1 Name1
2 Name2
10 Name3
110 Name4
1110 Name5

i don't know whether its going to be displayed well or not. i think i should explain what i want exactly that Name1, Name2, Name3, Name4, Name5 are right aligned
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-12-24 : 04:38:22
quote:
Originally posted by exorbitant

hi
i don't know why the text in my post is not displaying well. i want records like this

1 Name1
2 Name2
10 Name3
110 Name4
1110 Name5

i don't know whether its going to be displayed well or not. i think i should explain what i want exactly that Name1, Name2, Name3, Name4, Name5 are right aligned


This is formation issue. Do this in your front end application. To post formatted text here use code tags [ CODE ]...[/ CODE ] without spaces

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

exorbitant
Starting Member

17 Posts

Posted - 2008-12-24 : 06:41:01
quote:
Originally posted by madhivanan

quote:
Originally posted by exorbitant

hi
i don't know why the text in my post is not displaying well. i want records like this
[Code]
1 Name1
2 Name2
10 Name3
110 Name4
1110 Name5
[/Code]
i don't know whether its going to be displayed well or not. i think i should explain what i want exactly that Name1, Name2, Name3, Name4, Name5 are right aligned


This is formation issue. Do this in your front end application. To post formatted text here use code tags [ CODE ]...[/ CODE ] without spaces

Madhivanan

Failing to plan is Planning to fail



OK thanks a lot.
Go to Top of Page
   

- Advertisement -