views:

156

answers:

2
(WATCHDOGACIDT.COMASCALEE + WATCHDOGACIDT.COMASCALEV + 
                      WATCHDOGACIDT.COMASCALEM) AS EVM           --not work

(PATIENT_NAME.FIRSTNAME +' '+ PATIENT_NAME.LASTNAME) AS Fullname --work great

but this code return summary

ex 1 + 2 + 3 i would like return 123 but return 6 thank

+4  A: 

Like this:

CAST(myIntegerVar AS varchar(50)) + ' some text etc'

so:

(CAST(WATCHDOGACIDT.COMASCALEE as varchar(1)) + CAST(WATCHDOGACIDT.COMASCALEV AS varchar(1)) + CAST(WATCHDOGACIDT.COMASCALEM AS varchar(1)) ) AS EVM
Mitch Wheat
+1  A: 

Mitch's answer has the right approach, but in case you don't always know the length of the value you are casting to a varchar you don't need to specify the length. i.e. if one of your numbers was 450 or something, the varchar(1) wouldn't do the trick.

Like this:

CAST(myIntegerVar AS varchar) + ' some text etc'

(CAST(WATCHDOGACIDT.COMASCALEE as varchar) + CAST(WATCHDOGACIDT.COMASCALEV AS varchar) + CAST(WATCHDOGACIDT.COMASCALEM AS varchar) ) AS EVM
Jason w
+1. for not needing to know the size.
Mitch Wheat