超简单的问题

杰拉尔 2012-07-13 01:49:52

select id+',' from [dbo].[D_productArcTypeMapping]

会提示
消息 245,级别 16,状态 1,第 1 行
在将 varchar 值 ',' 转换成数据类型 int 时失败。

除非将ID转成varchar 我感觉比较麻烦有没有更好方法
...全文
77 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
王晓彤 2012-07-13
  • 打赏
  • 举报
回复
除非将ID转成varchar 我感觉比较麻烦有没有更好方法 只能去转换一下吧。
carpenter01 2012-07-13
  • 打赏
  • 举报
回复
select cast(id as varchar(10))+',' from [dbo].[D_productArcTypeMapping]
SQL77 2012-07-13
  • 打赏
  • 举报
回复
select LTRIM(ID)+',' from [dbo].[D_productArcTypeMapping]


天-笑 2012-07-13
  • 打赏
  • 举报
回复


select convert(varchar(8),id)+',' from [dbo].[D_productArcTypeMapping]



水族杰纶 2012-07-13
  • 打赏
  • 举报
回复
select ltrim(id)+',' from [dbo].[D_productArcTypeMapping]
select cast(id as varchar)+',' from [dbo].[D_productArcTypeMapping]

34,594

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧