|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Converting Integers
What is the best way to convert an integer to string, if you wanted to change how it looks in the result set?
For instance, Select channelid from table Results The Desired Results 2 Warehouse So I want to change how the results are viewed by converting the integer to a string. Maybe something like this select channelid AS 'Warehouse' from table where channelid = 2 |
|
#2
|
||||
|
||||
|
Code:
CAST(IntFieldName As varchar(length)) As 'IntToString' |
|
#3
|
|||
|
|||
|
Correction:
select channelid from table where select convert or cast(varchar(20), channelid = 2) AS 'Warehouse' So I want to change the value to Warehouse not the column name |
|
#4
|
|||
|
|||
|
Do you think I could use a case?
Select lm.BCID = Case type When '2' Then 'WholeSale4' When '7' Then 'WholeSale' End, lm.lid, lq.cmlastname, lq.cmfirstname, lm.totalloanamount FROM lm INNER JOIN lq ON lm.ldbid = lq.ldbid AND lm.ldid = lq.ldid Can I use joins with case stmts? Because I'm getting an error messages. |
|
#5
|
||||
|
||||
|
Something like this?
Code:
SELECT Case Type WHEN 2 THEN 'WholeSale4' WHEN 4 THEN 'WholeSale' End As 'Warehouse' FROM etc... |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Converting Integers |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|