tags:

views:

24

answers:

2

what's the proper way to write it? Thx

  SELECT 
      [JobId] as jobid


  FROM [v_Jobs]
  WHERE jobreference =177127

EXEC    [dbo].[s_someStoredProc] @JobID = jobid
+2  A: 

You need to store that value in a variable:

DECLARE @MyJobID INT

SELECT 
      @MyJobID = [JobId]
FROM [v_Jobs]
WHERE jobreference =177127

EXEC  [dbo].[s_someStoredProc] @JobID = @MyJobID
marc_s
A: 

If you're using MS SQL Server then you can do this very easily in Management studio. Rigth click on a stored procedure -> Execute -> Fill in the fields -> Management Studio generates a Query for you.

You can see how that works or just use the generated query.

Sjuul Janssen