sql嵌入VC存储过程返回值
程序代码:
要编两个存储过程实现如下的功能 EXEC SQL declare @cnt int; EXEC SQL exec ge_number @cnt output; //取出参数 再让MNumber=cnt //再将取出的参数赋值给全局变量MNumber EXEC SQL EXEC table_name :stable,:MNumber; //再在另外一个存储过程里面实现表名,参数都是变量的查询 基于此,如下编写的两个存储过程要怎么修改啊 int stable,MNumber; //全局变量 EXEC SQL CREATE Procedure table_name @tablename char([color=#800000; font-weight: bold]10[/color]),@ID int As exec('insert into ' +@tablename+ ' values(' +@ID+ ',1,1,1,1,1,1,1,1,1,1)'); //[color=#800000; font-weight: bold]1[/color] EXEC SQL CREATE Procedure ge_number @table nvarchar([color=#800000; font-weight: bold]50[/color]), @cnt int output AS declare @sql nvarchar([color=#800000; font-weight: bold]100[/color]) set @sql=N'select @cnt=number into :MNumber from '+@table exec sp_executesql @sql ,N'@cnt int output' , @cnt output; //[color=#800000; font-weight: bold]2[/color] 大侠帮帮忙啦