在将 varchar 值 转换成数据类型 int 时失败

越过越咸 越过越咸 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
create proc proc_kindName
(
@kind1 int,
@kind2 int,
@kind3 int,
@kind4 int,
@str varchar(500) output
)
as
if @kind1<>0
set @str=(select kindName from kind1 where auto_id=@kind1)+','
if @kind2<>0
set @str=@str+(select kindName from kind2 where auto_id=@kind2)+','
if @kind3<>0
set @str=@str+(select kindName from kind3 where auto_id=@kind3)+','
if @kind4<>0
set @str=@str+(select kindName from kind4 where auto_id=@kind4)
return ltrim(rtrim(@str))
go

declare @pp nvarchar(500);
exec proc_kindName 20,143,157,157,@pp output
select @pp
...全文
评论 11
收藏 已收藏
分享
返回顶部
越过越咸
MS-SQL Server 34,876 成员 254,635 内容