Sql server temp table

Posted on 2011-10-22
Last Modified: 2012-05-12
Hi Expert,

select * into tmpBusLine from BusinessLine

Is tmpBusLine a temp table? What is different between it with #tmpBusLine and what its scope?

Thanks in advance.
Question by:dshi15
    LVL 38

    Accepted Solution

    #tmptablename will be automatically deleted at the end of the script
    LVL 1

    Author Comment

    you mean tmpBusLine is not temptable?
    LVL 1

    Author Comment

    I should say 'you mean tmpBusLine is not  temporary table?'
    LVL 23

    Expert Comment

    by:Rajkumar Gs
    tmpBusLine - physical table
    @tmpBusLine - table variable
    #tmpBusLine - temporary table which can be accessed in the query window. When you close the window, the table will be destroyed. Tis table resides in session of sql server
    LVL 92

    Assisted Solution

    by:Patrick Matthews
    In your example, tmpBusLine is NOT a temporary table.

    To make it a true temp table, you would have to use #tmpBusLine or ##tmpBusLine (the ## indicates global scope).
    LVL 23

    Assisted Solution

    by:Rajkumar Gs
    This article would make you more clearer


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
    Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now