存储过程如下
CREATE PROCEDURE [dbo].[upt]
@station varchar(5),
@yeares int,
@monthes int,
@dayes int,
@tave money,
@num int output
AS begin
declare @sql varchar(200) If not exists(select 1 from [dbo].[tave] where [station] = @station and [yeares]=@yeares and [monthes]=@monthes and [dayes]=@dayes )
return 1 set @sql = '' If not @tave Is Null
set @sql = @sql + '[tave] = ' + @tave If @sql = ''
return 2
EXEC ('Update [dbo].[tave] set ' + @sql + ' where [station] =' + @station + ' and [yeares]=' + @yeares + 'and [monthes]=' + @monthes + ' and [dayes]=' + @dayes )
return 3 end
go
-----------------------------
调用语句
declare @num intexec dbo.upt '51053','2010','12','1',7,@num output
SELECT @num
------------------------------
出错信息
消息 235,级别 16,状态 0,过程 upt,第 39 行
无法将 char 值转换为 money。该 char 值的语法有误。
CREATE PROCEDURE [dbo].[upt]
@station varchar(5),
@yeares int,
@monthes int,
@dayes int,
@tave money,
@num int output
AS begin
declare @sql varchar(200) If not exists(select 1 from [dbo].[tave] where [station] = @station and [yeares]=@yeares and [monthes]=@monthes and [dayes]=@dayes )
return 1 set @sql = '' If not @tave Is Null
set @sql = @sql + '[tave] = ' + @tave If @sql = ''
return 2
EXEC ('Update [dbo].[tave] set ' + @sql + ' where [station] =' + @station + ' and [yeares]=' + @yeares + 'and [monthes]=' + @monthes + ' and [dayes]=' + @dayes )
return 3 end
go
-----------------------------
调用语句
declare @num intexec dbo.upt '51053','2010','12','1',7,@num output
SELECT @num
------------------------------
出错信息
消息 235,级别 16,状态 0,过程 upt,第 39 行
无法将 char 值转换为 money。该 char 值的语法有误。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货