Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SSIS 2008 sql任务返回变量_Ssis - Fatal编程技术网

SSIS 2008 sql任务返回变量

SSIS 2008 sql任务返回变量,ssis,Ssis,我在尝试从sql任务中检索值并将其传递给整数变量时遇到问题。我在单行中使用resultSet和Result Name=“0”,Variable Name=“Myvar”配置sql任务 以下是我在sql语句中使用的代码: select max(runid) from table 在这个查询中,使用max函数,我的变量总是得到默认值。 但是,在使用代码时: select runid from table ,我的变量获取正确的数据。 你能看出是什么问题吗 非常感谢是否尝试添加别名 select

我在尝试从sql任务中检索值并将其传递给整数变量时遇到问题。我在单行中使用resultSet和Result Name=“0”,Variable Name=“Myvar”配置sql任务 以下是我在sql语句中使用的代码:

select max(runid) from table 
在这个查询中,使用max函数,我的变量总是得到默认值。 但是,在使用代码时:

select runid from table 
,我的变量获取正确的数据。 你能看出是什么问题吗

非常感谢

是否尝试添加别名

select max(runid) as runid from table

是否尝试添加别名?“从表中选择max(runid)作为runid”。不过没关系,我创建了一个测试包,max()填充了一个变量。非常感谢,它也工作得很好!!很高兴它成功了-我添加了它作为一个答案,这样如果其他人搜索/有相同的问题,他们可以很容易地看到解决方案。如果下面的答案有效,您介意单击复选标记以指示问题已解决吗?