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)
 How to convert real to varchar in select

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2006-06-02 : 16:09:24
I have the following select query, the two fields i am concatenating.

the first one is a real(4) datatype and the second one is varchar.

i want to concatenate both with varchar.
************************************************************
SELECT SequenceNO + ' - ' + englishtext
from TAB_ccsNetRF rf, TAB_ccsNetModuleLinks link, TAB_ccsNetPickLists pick where link.LinkModuleRecordID = @ModuleID and link.LinkModuleName = 'CN' and link.ModuleRecordID = rf.rfid and link.ModuleName = 'RF' and rf.rftype= pick.pickid and pick.fieldlabelkey = 'lblrftype'
***********************************************************

Thank you very much for the info.

sanjnep
Posting Yak Master

191 Posts

Posted - 2006-06-02 : 16:44:27
SELECT CAST(SequenceNO AS VARCHAR(20)) + ' - ' + englishtext
from TAB_ccsNetRF rf, TAB_ccsNetModuleLinks link, TAB_ccsNetPickLists pick where link.LinkModuleRecordID = @ModuleID and link.LinkModuleName = 'CN' and link.ModuleRecordID = rf.rfid and link.ModuleName = 'RF' and rf.rftype= pick.pickid and pick.fieldlabelkey = 'lblrftype'


Sanjeev Shrestha
12/17/1963
Go to Top of Page

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2006-06-05 : 06:30:32
Or (if you want to avoid representations like '3.3E+8')...

SELECT ltrim(str(SequenceNO, 20))) + ' - ' + englishtext
from TAB_ccsNetRF rf, TAB_ccsNetModuleLinks link, TAB_ccsNetPickLists pick where link.LinkModuleRecordID = @ModuleID and link.LinkModuleName = 'CN' and link.ModuleRecordID = rf.rfid and link.ModuleName = 'RF' and rf.rftype= pick.pickid and pick.fieldlabelkey = 'lblrftype'


Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-05 : 07:01:45
Why do you want to concatenate?
If you use front end application, do concatenation there

Madhivanan

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

- Advertisement -