passing user defined table type variable between two inline table valued functions

523 views Asked by At

I know it is not possible to declare variables inside inline table valued function. Further more, user defined table type variable needs "SELECT INTO" or "INSERT" statements to fill data which is not possible in the inline table valued function.

What I want to do is:

  1. create two inline table valued functions funcA, funcB
  2. somehow declare and fill a table type variable inside, let's say, funcA
  3. then pass it to funcB as calling it

Is there any work around to overcome my problem? Thanks in advance.

1

There are 1 answers

0
Dev D On

You can declare variable table inside table-valued function like this:

   -- Declare a temporary table.
    DECLARE @TempNodeIDs TABLE
    (
          TMP_NodeID VARCHAR(100)
    )

    --Inserting data into temp table
        INSERT INTO @TempNodeIDs
        SELECT 'YOUR_VALUE'
    END