开发者

Convert Numeric value to Varchar

I'm trying 开发者_Python百科to fetch the records and append some letters to my numeric column, but I'm getting an error. I tried with cast and convert function.

For example:

select convert(varchar(10),StandardCost +'S')
from DimProduct where ProductKey = 212

here StandardCost is a numeric field, but when I fetch the record I get an error.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜