Updating table with table variable
In general, I just add the option at the final steps that I need to do to create the master or transactional datasets.
It tends to save some time because an additional sorting step is prevented.
Although you cannot use a table variable as an input or output parameter, you can return a table variable from a user-defined function – we will see an example later in this article.
Because of the well-defined scope, a table variable will generally use fewer resources than a temporary table.Knowing what we have learned so far, how do you decide on using a table variable or a temporary table?First, we know there are situations that which demand the use of a temporary table.The table definition of a table variable cannot change after the DECLARE statement.Any ALTER TABLE query attempting to alter a table variable will fail with a syntax error.