About 138,000 results
Open links in new tab
  1. sql - How to create Temp table with SELECT - Stack Overflow

    Jul 15, 2012 · Note also that any temporary table created inside a stored procedure is automatically dropped when the stored procedure finishes executing. If stored procedure A creates a temp table and calls stored procedure B, then B …

  2. How to create temp table using Create statement in SQL Server?

    Mar 26, 2017 · If you have an existing table with matching columns or a superset, you can also capture the types of the columns into a new temporary table called #temp_table simply by saying. select top 0 a, b, c into #temp_table from existing_table

  3. sql - How do you create a temporary table in an Oracle database ...

    No downvote, but I would never recommend a CREATE TABLE AS SELECT for a global temporary table - a less experienced developer might get the wrong idea that they have to populate GTTs this way every time. Sure, this is a convenient way of copying the definition from another table, but the example will probably confuse some people. –

  4. sql server - Temporary tables in stored procedures - Stack Overflow

    May 13, 2009 · Using table variables is usually the better answer. In a case where you need a complex temp table with indexing, then yes, a true temp table is preferred. In my years of looking at code, that is the exception. The OP gave a pretty simple example here suggesting a table variable is the more appropriate. –

  5. How to create temporary tables in SQL SERVER? [duplicate]

    Nov 29, 2019 · I am trying to create a temporary table in SQL Server from another table for example in Redshift I do the following. Create temporay table CARS as ( SELECT * FROM BD_CARS_111 ); SELECT * FROM CARS; Is there a similar statement in SQL SERVER?

  6. sql server - Check if a temporary table exists and delete if it exists ...

    Dec 6, 2016 · Technically there is nothing guaranteeing that the table's schema matches if the temp table already exists. It's likely the same, but you could have been doing something else with the table especially if you're using a generic name like #Results, #Products, or #Customers. This is the main reason I would use drop/create over truncate. –

  7. sql server - Difference between #temptable and ##TempTable?

    Jan 9, 2014 · A Local Temporary Table is only for the connection in which it was created. Each Local Temporary Table has a random value at the end of the table name. A Local Temporary Table is automatically dropped when the existing connection is closed, or the user can explicitly drop it with the following command "drop table #TempTable".

  8. How to create a Temporary Table in Spark-SQL (not a Temp View)

    Sep 25, 2023 · The difference between a temp table and a real table in T-SQL is that a temp table is automatically deleted when the session ends. The closest thing in Spark might be to use a dataframe instead of a temp table (as it disappears when the session ends). But you might run into difficulties mixing tables and dataframes.

  9. Local and global temporary tables in SQL Server

    May 27, 2010 · -- Session A creates a global temp table ##test in Azure SQL Database testdb1 -- and adds 1 row CREATE TABLE ##test ( a int, b int); INSERT INTO ##test values (1,1); -- Session B connects to Azure SQL Database testdb1 -- and can access table ##test created by session A SELECT * FROM ##test ---Results 1,1 -- Session C connects to another ...

  10. sql - Inserting data into a temporary table - Stack Overflow

    Nov 25, 2020 · Basic operation of Temporary table is given below, modify and use as per your requirements, -- CREATE A TEMP TABLE. CREATE TABLE #MyTempEmployeeTable(tempUserID varchar(MAX), tempUserName varchar(MAX) ) -- INSERT VALUE INTO A TEMP TABLE. INSERT INTO …

Refresh