Top "Table-variable" questions

A SQL Server local variable that can store rows.

SELECT INTO a table variable in T-SQL

Got a complex SELECT query, from which I would like to insert all rows into a table variable, but T-SQL …

sql-server tsql insert table-variable
What's the difference between a temp table and table variable in SQL Server?

In SQL Server 2005, we can create temp tables one of two ways: declare @tmp table (Col1 int, Col2 int); or …

sql-server temp-tables table-variable
Creating an index on a table variable

Can you create an index on a table variable in SQL Server 2000? i.e. DECLARE @TEMPTABLE TABLE ( [ID] [int] NOT …

sql sql-server tsql indexing table-variable
When should I use a table variable vs temporary table in sql server?

I'm learning more details in table variable. It says that temp tables are always on disk, and table variables are …

sql-server temp-tables table-variable
How to use table variable in a dynamic sql statement?

In my stored procedure I declared two table variables on top of my procedure. Now I am trying to use …

sql sql-server sql-server-2008 dynamic-sql table-variable
Table variable error: Must declare the scalar variable "@temp"

I am trying to achieve: declare @TEMP table (ID int, Name varchar(max)) insert into @temp SELECT ID, Name FROM …

sql-server tsql table-variable
Creating table variable in SQL server 2008 R2

what is table variable? And how to create a table variable (virtual in-memory table) with columns that match the existing …

sql-server-2008 table-variable
Can I loop through a table variable in T-SQL?

Is there anyway to loop through a table variable in T-SQL? DECLARE @table1 TABLE ( col1 int ) INSERT into @table1 SELECT …

sql sql-server tsql cursor table-variable
How do I drop table variables in SQL-Server? Should I even do this?

I have a table variable in a script (not a stored procedure). Two questions: How do I drop the table …

sql sql-server table-variable
How to see the values of a table variable at debug time in T-SQL?

Can we see the values (rows and cells) in a table valued variable in SQL Server Management Studio (SSMS) during …

sql debugging ssms table-variable