Reputation: 7197
Is it possible to pass datatable as parameter into stored procedure ? So, something like
exec MyStoredProcedure @MyDataTable
I am using SQL SERVER 2008.
Upvotes: 0
Views: 816
Reputation: 67311
You could create your own type: https://msdn.microsoft.com/en-us/library/ms175007.aspx
But it's quite a work... What exactly do you want to reach?
EDIT: Another suggestion Use an XML-Parameter (see comments below)
Upvotes: 1
Reputation: 3844
You need to create User-defined Table Type first.
-- Create the data type
CREATE TYPE udtt_Table AS TABLE
(
Column1 int,
Column2 varchar(10),
Column3 datetime
)
GO
You can use user-defined table type in your stored procedure like the following,
CREATE PROCEDURE usp_User
(
@UserTable udtt_Table READONLY
)
...
....
Upvotes: 4