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 2008 Forums
 Transact-SQL (2008)
 Conversion failed when converting varchar value

Author  Topic 

jimmy2090
Starting Member

26 Posts

Posted - 2014-06-19 : 02:12:20
Hi all,

i has 2 column integer and i would like to combine it to 1 column.

ColumnA ColumnB
11 22
40 45

i want the output as below:
11HD22
40HD45

i want to add the 'HD' between 2 integer.
select ( HEAD_COUNT + 'HD'  + CAPACITY) as HD_Capacity  from pccommitfiledetail


please help. thank you

Indsqlbeginner
Starting Member

21 Posts

Posted - 2014-06-19 : 02:54:09
try this
Select (CONVERT(varchar(20), ColumnA) + 'HD' + CONVERT(varchar(20), ColumnB)) HD_Capacity as from pccommitfiledetail
Go to Top of Page

jimmy2090
Starting Member

26 Posts

Posted - 2014-06-19 : 02:58:08
thanks, it solved.
Go to Top of Page
   

- Advertisement -