Stored Procedure Variables

前端 未结 1 519
萌比男神i
萌比男神i 2021-01-26 16:34

I am afraid my terminology has hindered me from finding the results I am looking for on the internet. Anyhow, I have a fairly complex stored procedure that I need to pass sever

1条回答
  •  太阳男子
    2021-01-26 17:17

    Yes you want to pass in a table valued parameter to your stored proc. Give this article a read:

    http://www.techrepublic.com/blog/the-enterprise-cloud/passing-table-valued-parameters-in-sql-server-2008/

    Basically you will define the type:

    CREATE TYPE myType AS TABLE
    (                     
           [myId] int NULL
    )      
    

    Then create a stored proc that accepts that type:

    CREATE PROCEDURE myProc
    (
          @TableVariable myType READONLY
    )
    AS
    BEGIN
    ...
    

    0 讨论(0)
提交回复
热议问题