SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to convert real to varchar in select
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

reddymade
Posting Yak Master

USA
165 Posts

Posted - 06/02/2006 :  16:09:24  Show Profile  Reply with Quote
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

USA
191 Posts

Posted - 06/02/2006 :  16:44:27  Show Profile  Visit sanjnep's Homepage  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
1074 Posts

Posted - 06/05/2006 :  06:30:32  Show Profile  Reply with Quote
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

India
22761 Posts

Posted - 06/05/2006 :  07:01:45  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000