DECLARE @t TABLE
declares @t TABLE (...)
What changes
- Input
- none
- Output or change
- empty table variable
Syntax at a glance
DECLARE @table_variable_name [ AS ] TABLE ( { <column_definition> | <table_constraint> } [ ,...n ] )
Work example
A batch needs a small in-memory rowset with a known column and key shape.
Declare only required columns. Compare the table variable with a temporary table when row count or indexing needs grow.
Check your work DECLARE @t TABLE. The declared key and types match the input and the variable ends with its scope.
Open Microsoft Learn for full syntax, permissions, and details for your version.