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
 General SQL Server Forums
 New to SQL Server Programming
 how do i combine 2 columns into 1 with TAB between

Author  Topic 

troyquigley
Starting Member

1 Post

Posted - 2008-10-30 : 16:09:51
i am using sql server 2000 & access 2002

here is what i am trying to do

column1
a
bb
ccc
dddd

column2
1
22
333
<null>

column3 formula: ([column1] + [column2])
gives me
a 1
bb 22
ccc 333
dddd <null>

i want this output
i want column3 to combine column1 & column2 so that column1 is left justfified and column2 is right justified
or
i want column1 to be left justified and column2 to start at a specified length (tab) from column1. so that the combining formula of column3 everything lines up properly.
ex

a.........1
bb........22
ccc.......333
dddd......<null>


AND
how do i get the column3 formula to not show the <null> ?

i am an SQL noob, trying to teach it to myself.

online signature:
intel e4300 @ 3.1ghz (arctic cooling freezer 7 pro)
asus p5n-e sli
evga 8800gt superclocked 512mb @ 650/1625/1900
a-data ddr2 800 4gb @ 775mhz
audigy 2 | wdc wd1600js 160gb sata
scores: 2001se = 48k | 2003 = 38k | 2006 = 12k
http://www.troyquigley.com
Jesus Christ is my Saviour!

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-10-30 : 16:19:47
select col1+char(9)+isnull(col2,'')
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-10-30 : 16:27:35
Or change your "query options" to Tab Delimited (instead of column aligned)
but if you're worrying about formatting in a query window then you probably have other issues to resolve

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -