Link to home
Start Free TrialLog in
Avatar of mainrotor
mainrotor

asked on

I need help running this stored proc from this query syntax.

I get an error when I try to run the following SQL Syntax:

with tbla as
(
      EXEC [sp_InventoryETA]
)

select * from tbla

User generated image
Avatar of Deepak Chauhan
Deepak Chauhan
Flag of India image

Do you want to inser SP's output in table. The syntax you written above is CTE syntax and i guess can not be executed this way.

You have to create a temp table,

1. create temp table.
2 insert into temp table
   exec ('exec [sp_InventoryETA]')
3 select * from temp table.
ASKER CERTIFIED SOLUTION
Avatar of TONY TAYLOR
TONY TAYLOR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
without knowledge of what the SP does, and what you want to achieve,  we are guessing.
What that SP returns?
Avatar of mainrotor
mainrotor

ASKER

Vitor,
The SP returns a list of records for products and their ETAs.