Results 1 to 4 of 4

Thread: Temporary Table

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    37

    Temporary Table

    Hi,

    I use VB2005 as front-end, SQL Server as backend. Can we do create temporary table as "Create table #username ....................."?
    when the user log off the program, then the temp table will be removed automatically, similar create temporary table in Query Analyzer, when close Query Analyzer, the temp table is removed.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Temporary Table

    To drop a table you have to execute a DROP TABLE statement. Presumably the authors of Query Analyzer have implemented the functionality to execute that statement for you. In your project you're the author, so it's up to you to implement that functionality.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    Re: Temporary Table

    The tables I create that I don't need get a "Drop tablename" after I'm done with them.
    Visual Studio .NET 2005/.NET Framework 2.0

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Temporary Table

    I don't know why you're asking. You could have tried this yourself.

    Anyway, temporary tables are automatically dropped when they go out of scope (when you close the connection), although you can drop them yourself before that point if you want.
    To create a temporary table you need the CREATE TABLE privilege.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width