我正在阅读某人的代码,但我不太明白。
for (var i = 0; i < tbl.Columns.Count; i++)
{
//If you're at the first column
if (i == 0)
{
row[i] = colorTable[rowNum];
}
else
{
row[i] = currentRow[rowNum, i + 1].Text;
}
}
如果将return设置为整数,下一行是什么意思?如何将@return设置为存储过程?是否调用存储过程?
答案 0 :(得分:4)
是的,调用存储过程,返回值存储在2017-04-04 16:59:56.185045: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-04-04 16:59:56.185185: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-04-04 16:59:56.186551: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-04-04 16:59:56.187141: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-04-04 16:59:56.187629: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-04-04 16:59:56.188138: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
正如documentation所说:
过程可以返回一个称为返回码的整数值,以指示过程的执行状态。您可以使用RETURN语句指定过程的返回码。与OUTPUT参数一样,必须在执行过程时将返回码保存在变量中,以便在调用程序中使用返回码值。例如,数据类型为int的赋值变量@result用于存储过程my_proc的返回码,例如:
@return
返回代码通常用于程序中的控制流程块,以便为每种可能的错误情况设置返回代码值。您可以在Transact-SQL语句之后使用@@ ERROR函数来检测在执行语句期间是否发生错误。
答案 1 :(得分:0)
从存储过程返回return value
。如果在过程中未显式返回值(例如return 2;
),则它将返回0
表示执行成功,如果遇到错误则返回负值。
参考:
以下是一些简单的例子:
create proc dbo.AllGood as
begin;
select 1 as One into #temp;
end;
go
create proc dbo.ReturnOneForOdd (@i int) as
begin;
if (@i % 2) = 1 return 1;
end;
go
create proc dbo.DivByZero as
begin;
begin try
select 1/0;
end try
begin catch
end catch;
end;
go
declare @r int;
exec @r = dbo.AllGood;
select @r as AllGood; /* returns 0 */
exec @r = dbo.ReturnOneForOdd 1 ;
select @r as ReturnOneForOdd; /* returns 1 */
exec @r = dbo.ReturnOneForOdd 2;
select @r as ReturnOneForOdd; /* returns 0 */
exec @r = dbo.DivByZero;
select @r as DivByZero; /* returns -6 */
rextester演示:http://rextester.com/WPNHX39195
答案 2 :(得分:0)
检查this link以获取有关将存储过程输出存储到变量的更多详细信息。以OUTPUT
变量作为参数的存储过程。