多线程同时执行一个存储过程,怎么才能取到不同的数据。
ALTER   PROCEDURE   [dbo].[sp_tmp_ad_GetIDS]    
 ( 
 	@TaskID   int, 
 	@sid   int, 
 	@n   int 
 ) 
 AS 
 BEGIN             
             declare   @table   table(id   int,keyword   nvarchar(200)) 
 	declare   @keywordid   int 
 	declare   @gettime   datetime 
 	select   @gettime=getdate() 
 	update   dbo.map_job_task   set   gettime=@gettime   where      TaskID=@TaskID   and   sid=@sid    
 	select   @keywordid=keywordid   from   dbo.map_job_task   where   TaskID=@TaskID   and   sid=@sid   and   gettime=@gettime 
 	update   dbo.map_job_task   set   keywordid=keywordid+@n   where      TaskID=@TaskID   and   sid=@sid   and   gettime=@gettime 
 	if(@@rowcount> 0) 
 		begin 
 			insert   into   @table    
 					select   top(@n)   id,keyword   from   dt_keyword   where   id> @keywordid   and   tag   is   null   order   by   id 
 			select   *   from   @table 
 		end 
 	else 
 		exec   sp_tmp_ad_GetIDS   @TaskID,@sid,@n 
 		--sp_tmp_ad_GetIDS 
 END
------解决方案--------------------传的参数不同 数据就不同
------解决方案--------------------对啊,传参变一下就好了