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
 concatenating columns of different Data types

Author  Topic 

Pratibhasurya
Starting Member

1 Post

Posted - 2006-08-04 : 14:55:18
We have a table in DB2, which has a column1 (Data type: - decimal (10, 0)) and column2 (Data type: - varchar (70)), I need to concatenate these two columns into one while displaying output

Procedure I followed:--

Tried to convert column1 to varchar using cast function so that I could concatenate both columns. However I ended up in getting the following error message

DB2 SQL error: SQLCODE: -461, SQLSTATE: 42846, SQLERRMC: SYSIBM.DECIMAL; SYSIBM.VARCHAR

Message: A value with data type "SYSIBM.DECIMAL" cannot be CAST to type "SYSIBM.VARCHAR".

Please do let me know where I went wrong

Thanks
Pratibha Surya

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-08-04 : 14:58:41
By DB2 u mean a database name, which is in MS SQL Server or the DB2 of IBM
Post the code, that u used to concatenate (if the RDBMS is MS SQL Server)

Srinika
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-08-04 : 18:09:13


SELECT CHAR(decCol1)||charCol2

viola

and the category is "New to SQL Server" as in Microsoft, not Big Blue...they parted ways years ago





Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page
   

- Advertisement -