由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Quant版 - SQL run a stored procedure by fetching from a cursor row by (转载)
相关主题
get value returned by SQLstored procedure from python (转载)compare two large tables SQL (转载)
SQL find distinct values in large table (转载)SQL combine two columns from two different tables no shared (转载)
SQL select one value column for each distinct value another (转载)大家来做一道题吧
error of executing SQL query of string concatenation[合集] phone interview brainteaser
matlab下载bb数据的问题请问cv中c++的水平应该怎么写
run SQL stored procedure from python (转载)来一道题 (转载)
keep group of values of SQL procedure in one table (转载)Ordering a sequence (2) (转载)
sort two same tables SQL but different results (转载)Interview question help --set partion
相关话题的讨论汇总
话题: fetch话题: cursor话题: declare话题: my话题: sql
进入Quant版参与讨论
1 (共1页)
l******9
发帖数: 579
1
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: SQL run a stored procedure by fetching from a cursor row by row
发信站: BBS 未名空间站 (Fri May 23 17:57:23 2014, 美东)
I need to run a stored procedure on SQL server 2008.
But, I can only fetch one row from the cursor. After that, the @@FETCH_
STATUS is -1.
DECLARE @my_table TABLE
(
code int not null
);
INSERT INTO @my_table (id)
SELECT DISTINCT a.id
FROM table1 as a
WHERE a.value = 'abc'
ORDER BY a.id ASC
DECLARE t_input CURSOR FOR
SELECT id
FROM @my_table
DECLARE @return_value tinyint
DECLARE @my_id varchar(3)
OPEN t_input
FETCH NEXT FROM t_input into @my_id
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC @return_value = my_procudure
@arg1 = 6,
@ar2 = 9
SELECT 'Return Value' = @return_value
FETCH NEXT FROM t_input into @my_id # this is -1 !!!!!!!!!!
END
So, it only run one iteration in the while loop.
my_procudure run well and has nothing to do with the cursor.
Any help would be appreciated.
1 (共1页)
进入Quant版参与讨论
相关主题
Interview question help --set partionmatlab下载bb数据的问题
what distribution is this?run SQL stored procedure from python (转载)
报个BarCap HongKong的offerkeep group of values of SQL procedure in one table (转载)
弱问excel调用c++ function的问题sort two same tables SQL but different results (转载)
get value returned by SQLstored procedure from python (转载)compare two large tables SQL (转载)
SQL find distinct values in large table (转载)SQL combine two columns from two different tables no shared (转载)
SQL select one value column for each distinct value another (转载)大家来做一道题吧
error of executing SQL query of string concatenation[合集] phone interview brainteaser
相关话题的讨论汇总
话题: fetch话题: cursor话题: declare话题: my话题: sql