title: Can T-SQL function return user-defined table type?
body: <p>I have my own type:</p>
  
  <pre><code>CREATE TYPE MyType AS TABLE
  (
      foo INT
  )
  </code></pre>
  
  <p>and a function receiving it as a parameter:</p>
  
  <pre><code>CREATE FUNCTION Test
  (
      @in MyType READONLY
  )
  RETURNS @return MyType
  AS
  ...
  </code></pre>
  
  <p>can it return <code>MyType</code> or only <code>TABLE</code> repeating MyType's structure:</p>
  
  <pre><code>CREATE FUNCTION Test
  (
      @in MyType READONLY
  )
  RETURNS @return TABLE (foo INT)
  AS
  ...
  </code></pre>
  
  <p>?</p>