Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2007
    Posts
    3

    Unanswered: How to use Sql Server's Temp table in vb.net

    There r two types of temporary tables in sql servers
    1) Local temporary table (#tablename)
    2) Global temporary table(##tablename)

    but when i m creating any temp table & using it in .NET it doesn't store all the data..
    i am storing data one by one but only last inserted row is visible in that table...

    any solution on that...

    pls help

    Thanks in advance...

    Mukund Tambe

  2. #2
    Join Date
    Mar 2007
    Location
    Holmestrand, Norway
    Posts
    332
    Make sure that you use one connection only, and that you do not close the connection between the inserts. Local temporary tables (#) are deleted when the connection through which they were created are closed. Global temporary tables (##) are deleted when the last connection referencing them are closed.

  3. #3
    Join Date
    Feb 2007
    Posts
    3
    Quote Originally Posted by roac
    Make sure that you use one connection only, and that you do not close the connection between the inserts. Local temporary tables (#) are deleted when the connection through which they were created are closed. Global temporary tables (##) are deleted when the last connection referencing them are closed.
    let me check..

    thanks a lot roac..

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You may also be a victim of "connection pooling" if you are running in an environment like ASP where you can have many threads sharing access to the same database. Each call to the database needs to stand on its own in a connection pooling environment, you can't depend on what may or may not have happened in a previous call to the database when you use connection pooling.

    -PatP

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    You have to let us know what you're doing...because it sounds dicey to begin with

    Can you write a stored procedure?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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