Creating and Using a Temp Table

Results 1 to 3 of 3

Thread: Creating and Using a Temp Table

  1. #1
    aspin Guest

    Default Creating and Using a Temp Table

    Could I be advised on creating and inserting /retrieving data from a temp table in .asp pages.<BR><BR>on page1.asp I created a temp table like this:...<BR>sql = "Create #MYTEMP_TABLE ....."<BR>THEN<BR>&#039;&#039;created a connection object pointing to a database.:oConn<BR><BR>oConn.Execute sql<BR><BR>After this , I move to page2.asp, NO ERRORS OCCUR SO FAR.<BR><BR>But the moment I try to insert data in the temp table LIKE THIS:<BR>sql = "INSERT INTO MYTEMP_TABLE VALUES(....."<BR>&#039;&#039;&#039;&#039;Using same connection object : oConn<BR><BR>oConn.Execute<BR><BR>I get an error saying MYTEMP_TABLE IS NOT FOUND...<BR>What am i doing wrong?<BR>Are temp tables stored in some tempdb by default??? If yes, what would my connection string be??? What would be the path to the tempdb??<BR>I also read that temptables live as long as the session is alive.<BR>Does "session" mean the same thing as what we refer to as an ASP Session : Will the temptable be alive and active till the user is surfing thro&#039; the website??

  2. #2
    Join Date
    Dec 1969

    Default RE: Creating and Using a Temp Table

    The Temp table is dropped automatically after the SQL executes on page1.asp<BR><BR>You can&#039;t make it persists. You&#039;ll have to make a regular table, but then drop that table when you&#039;re done. You might want to consider another approach to reduce the overhead, especially since you&#039;re not using stored procedures.<BR><BR>Tell us what you&#039;re trying to do. Maybe someone can come up with any idea.

  3. #3
    aspin Guest

    Default RE: Creating and Using a Temp Table

    I&#039;am trying to store user selections on the local intranet where a user can select products and their quantity and submit it . On submission I wanna take all the selections and their respective quantities and email it to the the despatch department of the firm so they can arrange to send the user all that he/she requires.<BR>Cookies was what I started with but they have limitations and were causing problems so I got rid of them. Someone suggested using temp tables, but as I read your reply, it&#039;s not gonna work out.<BR>Any alternate methods??

Posting Permissions

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