Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Referencing a Temp Table in ADO used in JScript

Author  Topic 

Plotin
Starting Member

21 Posts

Posted - 2005-12-05 : 12:45:47
Hi Guys

I am new to SQLTeam and not sure if post my question in the right forum but anyway still hope that someone can help me out.

The question I have is: How do you refer to a temporary table in the tempdb database from a client side script on a web page written in JScript?

function GETRECORDS(){
var adoCon;
adoCon = new ActiveXObject("ADODB.Connection.2.8");
adoRst = new ActiveXObject("ADODB.Recordset.2.8")
adoCon.Provider = "SQLOLEDB";
adoCon.CursorLocation = 3;
adoCon.IsolationLevel = 256;
adoCon.Mode = 2;
adoCon.ConnectionString = "Data Source = GFSSVR15;Initial Catalog = tempdb;Integrated Security = SSPI"

adoCon.Open;
adoCon.DefaultDatabase = "tempdb";

adoRst.Open("Select * From [OBJECTNAME]",adoCon,3,1);

window.alert(adoRst.RecordCount);

adoRst.Close;
adoCon.Close;
}

The object name in sysobjects is
#tempOfferLimit_____________________________________________________________________________________________________00000003010A

The following variations for [OBJECTNAME] were used:

#tempOfferLimit

#tempOfferLimit00000003010A

#tempOfferLimit_____________________________________________________________________________________________________00000003010A

None of them is able to reference the table in tempdb.

Thanks in advanced for any hint

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2005-12-05 : 16:38:47
A #TEMP table is only available to the user who created it, and within the connection that created it. If you need to access data across user/connection boundaries you will need to create REAL tables with some type of naming convention that you can manage, and you would also need to be sure to remove them.

What is the problem you are trying to solve by doing this? There might be another way.
Go to Top of Page

Plotin
Starting Member

21 Posts

Posted - 2005-12-05 : 18:09:04
I have to make changes to data residing in the production environment and being displayed in a web browser
using asp technologies.

The reason to create temp tables and populate them with the data in question is to be enabled this way to change the data and not screw things up to badly when messing up the data.
Displaying the data in the web browser would just enable me to check the correct formatting of the columns.

No DDL rights are assigned to me.

Plotin
Go to Top of Page

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2005-12-05 : 20:34:33
The DBA should easily be able to create a TEST database that you can use as an environment to test with. It is absolutely unacceptable not to be able to have an environment you can actually test in. I can understand not giving you free rain in the Production environment, but that is why there are usually DEV, TEST and PRODUCTION versions of the database. Short of that, they should be able to give you a TEST database (should take them 5 minutes) and make your user id the database owner for that TEST database. So you can actually do your job. Because you will not be able to in the TEMPDB environment.
Go to Top of Page

Plotin
Starting Member

21 Posts

Posted - 2005-12-06 : 08:37:20
Hi druer

Unfortunately some workplaces are run by narrow minded so called leaders.

But since I have installed MSDE on my machine I am using OpenRowset to populate a "replication" of the tables needed and use my machine as a test environment.
When finished with testing, the data in the production environment will just be updated using distributed queries.

PS:Replication is wrapped in double quotation marks in order to avoid the thought that so called leaders would allow me to use Replication Services.

Plotin
Go to Top of Page

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2005-12-06 : 11:58:16
Oh no ... not one of those kind of workplaces. Best of luck.
Go to Top of Page
   

- Advertisement -