Getting problem with temporary tables

  • I am working on vb as front end, sql as bank end. In my application i am creating temporary tables, and i am unable to access those #tables along with the base tables. I used ADO in VB. When I opened #table as a recordset, the connection is unable to find the base tables.

    Kindly help me out in this

    Thanks

    Mahesh

  • Hi i found out that there is a problem with ado connecting to temp tables. Temp tables only exists in a connection. After the connection they are automaticly dropped. Somehow ado disconnects after you call a sp. The work arround i used is to use ## (global temp tables) . The disadvantage is that these tables can be seen by all users.

  • hi jan

    Thanks for ur reply. I can understand once the connection is closed, #tables will be deleted. But my connection is still open and #table still available in the server. My problem is i am unable to use both #tables and base tables in a single connection. And I can not use ##tables because based on the connection i am creating a #table specific to that user with deferent data.

    Some of the data is available in #table and some in base tables. Combination of these tables i will get the information specific to a user.

  • If you're creating them inside a proc they get dropped when the proc exits - see BOL for more info on the life time of #temp objects.

    Mahesh, could you post your code?

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • hi Andy

    I am creating #temp objects in VB code not using proc and these objects are available and i am able to use. Once these #temp objects are opened using a recordset(successful), unable find out the base tables by using the same connection and it is giving an error like object or table not found. I want to use both temporary table and the original base table with diferent recordsets.

    If I open a base table as a recordset, connection is not finding #temp object(#temp object is still available in the server) vice versa.

    You are asking for code, simply by using the seelect into statement in VB.

    Mahesh

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply