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 2000 Forums
 SQL Server Development (2000)
 Select query concatenating two columns into one

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2005-11-14 : 11:14:22
I am trying to concatenate two columns first one varchar and second one real(4) datatype. I am getting an error with real conversion.

SELECT TRIM(CNTitle) + ' ' + SequenceNO AS description FROM Tableorders

Thank you very much for the information.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-11-14 : 11:21:57
'TRIM' is not a valid SQL Server function.





CODO ERGO SUM
Go to Top of Page

reddymade
Posting Yak Master

165 Posts

Posted - 2005-11-14 : 11:32:43
Sorry that was a typing mistake, i am using rtrim. But the problem is with the real datatype conversion.
Can you please tell me how to concatenate a real datatype with varchar column and show as one putput column.
Thank you.

quote:
Originally posted by Michael Valentine Jones

'TRIM' is not a valid SQL Server function.





CODO ERGO SUM

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-11-14 : 14:54:14
What is the error message you are getting?




CODO ERGO SUM
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-14 : 14:59:56
try converting it to varchar:
SELECT TRIM(CNTitle) + ' ' + convert(varchar(30), SequenceNO ) AS description FROM Tableorders


Go with the flow & have fun! Else fight the flow
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-11-14 : 15:06:02
quote:
Originally posted by spirit1

try converting it to varchar:
SELECT TRIM(CNTitle) + ' ' + convert(varchar(30), SequenceNO ) AS description FROM Tableorders


Go with the flow & have fun! Else fight the flow



Ummmmm..that would be


SELECT RTRIM(CNTitle)
+ ' '
+ CONVERT(varchar(30), SequenceNO ) AS [description]
FROM Tableorders



But why use RTRIM? is CNTitle char(xx)?





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 -