请教----存储过程中数据类型的问题
CREATE PROCEDURE sf_Static_Frequency
(
@my_Times int = 0
)
AS
declare @strSQL varchar(1000)
select @strSQL = 'update mytable set a = a+'+ @my_Times + ' where id = 5'
exec(@strSQL)
GO
怎么老是说@my_Times数据类型不对?
我查看了下,传递过来的是整数。 难道select @strSQL = 'update mytable set a = a+'+ @my_Times + ' where id = 5'这一句有错误?
请高手指教,谢谢!
问题点数:20、回复次数:4Top
1 楼lsqkeke(可可)回复于 2006-03-01 18:34:03 得分 10
select @strSQL = 'update mytable set a = a+'+ cast(@my_Times as varchar)+ ' where id = 5'
试一下Top
2 楼ping3000(苦练葵花点穴手)回复于 2006-03-01 20:14:57 得分 0
@strSQL 是字符型的@my_Times是整型的,可以用STR(@my_Times)Top
3 楼happyflystone(无枪的狙击手)回复于 2006-03-01 20:19:59 得分 5
select @strSQL = 'update mytable set a = a+'+ convert(varchar(10),@my_Times)+ ' where id = 5'
Top
4 楼ReViSion(和尚)回复于 2006-03-01 21:22:38 得分 5
select @strSQL = 'update mytable set a = a+'+ cast(@my_Times as varchar)+ ' where id = 5'Top
相关问题
- 存储过程类型数据窗口调用ORACLE8.1中存储过程返回的记录集(加100分)
- 怎样用PB6.5存储过程类型数据窗口调用ORACLE8.1中存储过程返回的记录集
- 在存储过程中,怎么返回表类型的数据啊?
- SQL SERVER2000存储过程中传入参数的数据类型问题
- 存储过程中数据类型转换的小问题,请大侠赐教
- MS-SQLSERVER2000中如何使用存储过程操作image类型数据?
- sos!怎样用PB7存储过程类型数据窗口调用ORACLE8.1中存储过程返回的记录集
- 怎么在存储过程中使用另一个存储过程的数据
- 在存储过程中,如何把varchar类型的数据赋值给text类型的变量
- 急!c#中调用存储过程,有何数据类型对应sqlserver2000中的numeric?可以传值?




