About 1,150,000 results
Open links in new tab
  1. What's the difference between a temp table and table variable in …

    Aug 26, 2008 · If you're writing a function you should use table variables over temp tables unless there's a compelling need otherwise. Both table variables and temp tables are stored in …

  2. SELECT INTO a table variable in T-SQL - Stack Overflow

    Oct 1, 2010 · Got a complex SELECT query, from which I would like to insert all rows into a table variable, but T-SQL doesn't allow it. Along the same lines, you cannot use a table variable with …

  3. sql server - Put stored procedure result set into a table variable ...

    Oct 7, 2024 · I have a stored procedure with many parameters. I want to insert (or maybe select) like this: INSERT INTO @TEMP_TABLE EXECUTE STORED_PROCEDURE without defining …

  4. How to declare a table variable with existing data in sql server

    Mar 19, 2020 · How to declare a table variable with existing data in sql server Asked 5 years, 8 months ago Modified 5 years, 8 months ago Viewed 48k times

  5. SQL Server tables: what is the difference between @, # and

    Feb 8, 2010 · I would focus on the differences between #table and @table. ##table is a global temporary table and for the record in over 10 years of using SQL Server I have yet to come …

  6. sql server - How to use table variable in a dynamic sql statement ...

    On SQL Server 2008+ it is possible to use Table Valued Parameters to pass in a table variable to a dynamic SQL statement as long as you don't need to update the values in the table itself. So …

  7. Can I loop through a table variable in T-SQL? - Stack Overflow

    I would like to be able to use a table variable in the same manner as a cursor. That way I could execute some query on the table variable in one part of the procedure, and then later execute …

  8. sql - Creating an index on a table variable - Stack Overflow

    May 20, 2009 · In the table variable definition at the beginning of this answer the non unique non clustered index on Name is simulated by a unique index on Name,Id (recall that SQL Server …

  9. When should I use a table variable vs temporary table in sql server ...

    Aug 8, 2012 · A table variable is almost always in tempDB - that "in memory" is a myth. Also: table variables will always be regarded by the query optimizer to hold exactly one row - if you have a …

  10. Pass a table variable to a SQL Server stored procedure

    Jun 18, 2017 · I'm trying to pass a table variable to a stored procedure and I get the error: Operand type clash: table is incompatible with TY_MyType Here are the relevant pieces of …