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 2005 Forums
 Transact-SQL (2005)
 How to concatenate real datatype field to varchar

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2008-01-08 : 11:34:51
How to concatenate a real datatype field to a varchar.

rf.SequenceNO is a real datatype field i am concatenating below.

select rfid, (select 'RF' + EnglishText from Tab_picklists
where fieldlabelkey='lblRFType' and pickid=RF.RFType) + ' - ' + rf.SequenceNO as RFRecord from Tab_RF RF where rf.contractid=17


Thank you very much for your help.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-08 : 12:55:10
Try with CAST function and see if it preserves the accuracy.

select rfid, (select 'RF' + EnglishText from Tab_picklists
where fieldlabelkey='lblRFType' and pickid=RF.RFType) + ' - ' + CAST(rf.SequenceNO as varchar(x)) as RFRecord from Tab_RF RF where rf.contractid=17

x will be max length of real value field
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-09 : 02:10:42
quote:
Originally posted by cplusplus

How to concatenate a real datatype field to a varchar.

rf.SequenceNO is a real datatype field i am concatenating below.

select rfid, (select 'RF' + EnglishText from Tab_picklists
where fieldlabelkey='lblRFType' and pickid=RF.RFType) + ' - ' + rf.SequenceNO as RFRecord from Tab_RF RF where rf.contractid=17


Thank you very much for your help.


Most likely this is formation that should be done in your front end application, if used

Madhivanan

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

- Advertisement -