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)
 Temp tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-08 : 22:03:15
Farouk writes "I am creating a stored procedure with the main purpose of updating table "X", however the information required in table "X" is being drawn from approxiametly 7 different tables.

I am using a select statement to select the records from table "Y" and place them in a temporary table. Thereafter a cursor is being used to step through the temporary table. A calculation has to be performed from certain fields within 7 different tables, before inserting the information into table "X".

This procedure is being called within a scheduler in VB that shall run daily at an appointed time however, it is also possible to run this procedure manually from a remote site using ASP.

I would like to create a temporary table as soon as the procedure is run, whether as per schedule or manually. The sole purpose of this temporary table is to ensure that the procedure cannot be run simultaneously, as per schedule or manually.

SQL has the statement IF EXISTS, is it possible to check whether the temporary table has been created before proceding with the rest of the SQL statements.

Any feedback would be greatly appreciated.

Regards

NB. I am using WIN 2000 O/S and SQL 2000."
   

- Advertisement -