Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to apply one condition on which the insert statement should work. I need to control what is getting inserted into temp tables from the storedproc output.
SQL
insert into #temptable 
exec dbo.spGetInformation @input
Posted

Hi
You can probably use MSDN : Stored Procedure Output Paramter[^]

[Edit]
If you are not able to change your stored procedure then you can only check for successful execution of stored procedure.
SQL
DECLARE @result int;
EXECUTE @result = my_proc;

@result value 0 means that your stored procedure executed successfully.

For more information check this link[^]
[/Edit]

Best Luck.
 
Share this answer
 
v2
Comments
Bharath from India 23-Apr-13 6:58am    
I dont have permission to edit the spGetInformation to include an output param
AmitGajjar 23-Apr-13 6:59am    
What spGetInformation does ? is that only getting information from table ?
Bharath from India 23-Apr-13 7:11am    
yes.. it was a complex query fetching data from tables. and I am not supposed to disrupt that SP
AmitGajjar 23-Apr-13 7:29am    
have you checked my updated answer ?
Hello Bharath,

Sine you have not given the details about your stored procedure, I suggest you to have a look at this article [^]. The Table-valued Functions or Temp Tables might be the options you are looking at.

Regards,
 
Share this answer
 
Comments
Bharath from India 23-Apr-13 6:59am    
I am looking for something like this :
insert into #temptable
exec dbo.spGetInformation @input
where output_of_sp= condn

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900