Pra*_*wal 17 sql sql-server-2005
我尝试使用在我的数字列中添加一些alphabt来获取记录.但我得到错误,我尝试使用强制转换功能.
例如
select convert(varchar(10),StandardCost +'S')
from DimProduct where ProductKey = 212
Run Code Online (Sandbox Code Playgroud)
这里StandardCost是一个数字字段,但是当我获取记录时我得到错误请看看.
May*_*shP 35
我认为应该是
select convert(varchar(10),StandardCost) +'S' from DimProduct where ProductKey = 212
Run Code Online (Sandbox Code Playgroud)
要么
select cast(StandardCost as varchar(10)) + 'S' from DimProduct where ProductKey = 212
Run Code Online (Sandbox Code Playgroud)
首先转换数值然后添加'S':
select convert(varchar(10),StandardCost) +'S'
from DimProduct where ProductKey = 212
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
153757 次 |
| 最近记录: |