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)
 concat

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2007-11-16 : 13:18:13
I have a table which contains data below

Select col1,col2 from table1

Col1 Col2
---- -----
01.00 Test1
02.00 Test2


I want data to be displayed like

ConcatCol
-------------
'01.00','Test1'
'02.00','Test2'


Thanks for your help in advance!!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-11-16 : 13:26:30
You can use + to concatenate strings in T-SQL.

SELECT Column1 + Column2 AS NewColumn
FROM YourTable

You'll need to add the formatting to the string though.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-19 : 02:19:33
Also you need to cast the columns to varchar if they are not

Madhivanan

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

- Advertisement -