i m trying to fetch the record using append some alphabt in my numeric column. but i m getting error, i tried with cast and convert function.
for exmaple
select convert(varchar(10),StandardCost +'S')
from DimProduct where ProductKey = 212
here StandardCost is a numeric field, but when i fetch the record i m getting error please have a look.
This question is related to
sql
sql-server-2005
i think it should be
select convert(varchar(10),StandardCost) +'S' from DimProduct where ProductKey = 212
or
select cast(StandardCost as varchar(10)) + 'S' from DimProduct where ProductKey = 212
First convert the numeric value then add the 'S'
:
select convert(varchar(10),StandardCost) +'S'
from DimProduct where ProductKey = 212
Source: Stackoverflow.com