0

I am trying to look on the web for a way to create a stored procedure that I can run and then put in multile values and this is the closest I can find:

CREATE TYPE dbo.EmployeeList
AS TABLE
(
  EmployeeID INT
);
GO

CREATE PROCEDURE dbo.DoSomethingWithEmployees
  @List AS dbo.EmployeeList READONLY
AS
BEGIN
  SET NOCOUNT ON;

  SELECT EmployeeID FROM @List; 
END
GO

Is it possible? I want to create this procedure so that I can run it on my machine for reporting purposes and be able to put in one employee ID or multilpe and it still works? and I will not need to create a separate stored procedure per report.

2
Contributors
2
Replies
10
Views
2 Years
Discussion Span
Last Post by hericles
0

I should add that once you have your stored procedure written correctly, you call it and add the required parameters to the command object as you normally would to pass parameters for a normal SQL command.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.