MSSQL 2000, ODBC, Tempdb, Locking

May 14, 2002

Hi, I wonder if anyone can shed some light on this issue -

We have a client/server program for MSSQL7 and MSSQL2000.
When running client/server - we have our own broker, etc,
the program ends up locking itself on SQL2000; this is not a problem on SQL7.
We noticed that it seems some system tables locking tempdb.
We also noticed that SQL2000 no longer has insert-into/bulkcopy option like SQL7. But, here we don't have temporary tables at all. It's just that we found the lockings in tempdb caused by some sysobjects, sysindexes, etc.
Also, this does not happen to all the systems we have. Some of our machine does not have the self-lock problem; most of the machines have this problem though.

If we don't run client/server, then the program works fine.
Same logic, the difference is when we use client/server logic to connect to the remote SQLServer 2000 server, the locking might happen on most of our machines.

Anyone is familiar with tempdb and locking issues, please provide some hint??? Is it possible that there are some system parameters that we can set to avoid the problem. We haven't found out why some of our machines do not have problem, while most of the machines have this locking problem.

The program is written using ODBC.

Many thanks in advance.

HIBA International

View 2 Replies


ADVERTISEMENT

MSSQL 2000 ODBC Driver

Apr 11, 2005

Hello,

I normally use Microsoft Access to retrieve data , via ODBC connection, from a table in a SQLserver database. One of the fields in the table has a value 1 but at times when the data is retrieved into MS Access it turns out to be 100 in Access. Moreover, when I try to change it in Access my computer hangs or it takes a long time before the change is effected. It does not matter from which client Pc this action takes place it remains the same. I am using ODBC SQLserver ODBC driver version 2000.81.9042.00.

I would be grateful if you could help me out of this strange situation.

Regards,

Albert

View 4 Replies View Related

Locking On Tempdb...

Jul 23, 2005

Hi Group,I am facing a problem regarding locking. I have created a StoredProcedure in my Database. In this Stored Procedure Temprary Tables getcreated and after that values are inserted in these tables.But thisStored Procedure is called from Java Portal. When then Stored Procedureexecute from Java end new transaction begins. So all these temporarytables are created in tempDB and locking the entire Database.So at the same time if another user fires the same Stored Procedurefrom portal end its give the error "Lock time out". But if the prevStored Procedure execution gets competed before this request then noerror comes.So is there any way from database to restrict to lock the tempDBdatabase????Can you provide some valuable advice?Thanks in advance.RegardsArijit Chatterjee

View 8 Replies View Related

Tempdb - Locking System Tables

Mar 9, 1999

I have some stored procs that have temp table creations in them using "create table #tmptable...". I have noticed that when running the procs, sp_lock shows tempdb system tables being locked. I totally expect this. But, put a PowerBuilder front end on, and I get another situation. Calling the stored procs from PowerBuilder causes the same locks to occur, but they are not released after the data is displayed through the application. Furthermore, this blocks other users from creating anything in tempdb until the user logs off of the application and ends the connection to the database.

please help - is there something I am missing in my procedures, or is this a PowerBuilder issue?

Thanks!

Dean

View 1 Replies View Related

Locking An MSSQL Record With ADO.NET

Jul 23, 2005

Is there a way using ADO.NET to lock a record so that you can performan atomic Test and Set operation on one of its fields?I want to set an application level lock bit on a record's field (set itfrom 0 to 1) and at the same time determine that it was 0 before Ibegan and that I was the one who set it to 1, or that it was 1 before Igot to it (and thus I do not own the lock to the record).I don't see anything that explains if this can be done using ADO.NETusing MSSQL. Any help is greatly appreciated.

View 3 Replies View Related

ODBC And Record Locking

Mar 15, 2007

I found this interesting paper at http://ftp.sas.com/techsup/download/v8papers/odbcdb.pdf, comparing OLEDB to ODBC.

It says that OLEDB provides record locking where ODBC doesn't. I can't quite reconcile that statement; what does it mean? How is the access layer involved in determining type of locks used by the server in executing a statement?

.B ekiM

View 3 Replies View Related

Server Configuration For MSSQL 2000 And MSSQL 2005

Sep 6, 2006

Does enabling/disabling Data Execution Prevention have a performanceimpact on SQL 2000 or SQL 2005?For SQL best performance - how should I configure for:Processor Scheduling:Programs or Background servicesMemory Usage:Programs or System Cache

View 9 Replies View Related

Creating Index In MSSQL 2000 From MSSQL 2005

Mar 24, 2008

Hi,

I am a bit new to the MSSQL server. In our application, we use so many SQL queries. To imporve the performance, we used the Database enigine Tuning tool to create the indexes. The older version of the application supports MSSQL 2000 also. To re-create these new indexes, I have an issue in running these "CREATE INDEX" commands as the statements generated for index creation are done in MSSQL 2005. The statements include "INCLUDES" keyword which is supported in MSSQL 2005 but not in MSSQL 2000.

Ex:-

CREATE INDEX IND_001_PPM_PA ON PPM_PROCESS_ACTIVITY

(ACTIVITY_NAME ASC, PROCESS_NAME ASC, START_TIME ASC, ISMONITORED ASC)

INCLUDE

(INSTANCE_ID, ACTIVITY_TYPE, STATUS, END_TIME, ORGANIZATION);


Any help in creating such indexes in 2000 version is welcome.

Thanks,
Suresh.

View 2 Replies View Related

Generating Script For MSSQL 2000 From MSSQl 2005?

May 3, 2008

Hello
We are using SQL 2005 and now we are planning to use SQL 2000. what are the ways to do the process.

We taken the script spcificall for 2000 and run it in SQL 200. But we are getting the error in SCRIPT?

Could you please give me the step to do?

Thanks,
Sankar R

View 6 Replies View Related

Access 2000 Frontend MS SQL 2000 Backend - Locking Problems

Aug 20, 2007

We are using an Access 2000 project to view our SQL Tables and using Access 2000 Runtime to Access the forms in the project. We have written in a locking system in VB and removed the video controls to prevent users from accessing the same records. But of course now we need to make the video controls available. This has now thrown up the problem of multiple users accessing the same records. We have tried to write code to lock records when then video controls are used but this is not working as well as we hoped. Can anyone please suggest any way of setting up locking on SQL using triggers from the Access frontend? or any other types of locking systems that could be written in the Access front end.

View 1 Replies View Related

MSSQL Express 2005 Vs. MSSQL 2000

Jun 15, 2006

Ben writes "I have a sql script that doesn't function very well when it's executed on a SQL 2000 server.

The scrpt looks like this:


---------------------------------------------------------------------------------------------------
USE [master]
GO
IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
EXEC sp_addlogin N'SSDBUSERNAME', N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
If EXISTS (Select * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
ALTER LOGIN [SSDBUSERNAME] WITH PASSWORD=N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
IF EXISTS (select * from dbo.sysdatabases where name = 'ISIZ')
DROP DATABASE [ISIZ]
GO
USE [SurveyData]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
GO
USE [SurveyManagement]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
---------------------------------------------------------------


I need to be converted to a script that can be executed on both MSSQL 2000 and MSSQL 2005.

I was wondering if somebody there could help me with this problem?!

Thanks,
Ben"

View 1 Replies View Related

Migration MSSQL 2000 32-bit To MSSQL 2005 64-bit

Nov 17, 2007

I've been tasked to move our production databases on MSSQL 2000 to 2005. I've supported MSSQL since version 6.5 and performed migrations to successor versions.

Current Environment is MSSQL 2000 32-bit with current Service Packs.

I've performed mock migrations on Test servers upgrading all Production instances simultaneously from MSSQL 2000 to 2005 32-bit. The Test environment is identical to Production minus server name, IP etc. Also I have a separate server with MSSQL 2005 installed where I use the DETACH / ATTACH and BACKUP / RESTORE method for migration / acceptance testing. There are approximately 30 databases totaling 70 GB. This has gone as expected and fairly successful. Vendors have been coordinated with to update code and staff for acceptance testing.

I'd prefer going directly to MSSQL 2005 64-bit instead if possible due to memory benefits etc. This is where I'd like some feedback prior to borrowing a 64-bit server for testing.

Upgrade options:

1. Is it better to migrate from MSSQL 2000 32-bit to 2005 64-bit via:
a. DETACH / ATTACH
b. BACKUP / RESTORE
c. Is one method more advantageous relating to the end result?
2. Regarding XP clients, have issues been experienced with the default SQL Server driver or is an alternate recommended for XP clients to connect to a MSSQL 64-bit server databases?
3. If you have performed this migration and have relevant experience please pass them along.

View 3 Replies View Related

MSSQL ODBC Vs. ADO

Sep 17, 2004

We have in our applications written in VC++ access also to MSSQL but only over ODBC. Is there any performance difference (is ADO faster) between ODBC and ADO access? And if yes how much it could be ?
Thanks for your answer.

View 1 Replies View Related

MSSQL ODBC Question

Jul 11, 2006

I work with a FoxPro programmer who wants to use an ODBC connection from his foxpro inventory database to the websites mssql inventory database to do quanity+1 updates.

But he is not sure if OBDC (or MSSQL for that matter) supports those kind of updates (field+1 instead finding out what field value is and then incrementing it).

Can one of your pros confirm or deny this?

thanks!

View 3 Replies View Related

ODBC 3.x MsSql 2005

May 6, 2008

First off, Devshed is a great place to find information for development. I'm on here daily looking through threads, finding answeres

I'm building a backend for a program that uses msSql 2005 and ODBC .
I'm trying to insert into a table, and it is working, but i would like to find a solution to this error i get from the odbc trace:

Calc f54-5c4ENTER SQLExecute
HSTMT 00924A18

Calc f54-5c4EXIT SQLExecute with return code -1 (SQL_ERROR)
HSTMT 00924A18

DIAG [22018] [Microsoft][SQL Native Client]Invalid character value for cast specification (0)

when i try to insert a value of 0 (zero) into a column that is bound as a double it gives this error.

And one more thing:
if(retcode != SQL_SUCCESS | SQL_SUCESS_WITH_INFO)

shouldnt that work? (if Retcode isnot success OR success_with_info)

Any input would be greatly appreciated!
thanks

View 2 Replies View Related

How To Get Server Name? (Using VC++, MSSQL && ODBC)

Jun 9, 2006

Hi. Is there a way in order to get the Server name using MSSQL ODBC in Visual C++? Here's my code:

CString wstr_connect ;
wstr_connect.Format( "DSN=%s;UID=%s;PWD=%s", gstr_DBName, gstr_UserID, gstr_Password ) ;
CDatabase mydb ;
BOOL ret = mydb.OpenEx( wstr_connect, CDatabase::noOdbcDialog ) ;
CString info = mydb.GetConnect( ) ;

GetConnect only returns the database name, user ID, password and WSID. How do i get the server name?

Thanks in advance!

View 4 Replies View Related

MSSQL ODBC And Transactions

Feb 20, 2008


Hi There,

I have developed the ODBC app which can work with Oracle as well as MSSQL server databases. I need to use transactions at some level. By setting AUTOCOMMIT OFF and using SET TRANSACTION and BEGIN WORK, COMMIT WORK everything works fine with Oracle. But with MSSQL server does not. Do I need to code something special for MSSQL? Does anyone has example on how to implement transactions with MSSQL server using ODBC?

I tried reading lots of documents on Microsoft site but nothing specifically says how to do this. One way the doc says is using SQLSetConnectAttr with SQL_ATTR_TXN_ISOLATION but does not specify how to.

Any help with appreciated. Thanks in advance.

Milind

View 4 Replies View Related

MSSQL ODBC And Transaction

Feb 20, 2008

Hi There,

I have developed the ODBC app which can work with Oracle as well as MSSQL server databases. I need to use transactions at some level. By setting AUTOCOMMIT OFF and using SET TRANSACTION and BEGIN WORK, COMMIT WORK everything works fine with Oracle. But with MSSQL server does not. Do I need to code something special for MSSQL? Does anyone has example on how to implement transactions with MSSQL server using ODBC?

I tried reading lots of documents on Microsoft site but nothing specifically says how to do this. One way the doc says is using SQLSetConnectAttr with SQL_ATTR_TXN_ISOLATION but does not specify how to.

Any help with appreciated. Thanks in advance.

Milind

View 3 Replies View Related

Win32::ODBC Connect To MSSQL

Apr 19, 2004

Hi,

I wanted to know if there is a way to connect to my MSSQL without having to setup a datasource in the control panel.

Perferably I want to locate the database within my perl code instead. I don't want to have to setup a datasource each time I need a different database. Perhaps there is a way to pass the name of the database along with the username and password through the command line.


Any suggestions?

Thanks.

View 5 Replies View Related

MSSQL && ODBC Float Problem

Sep 27, 2007

Hi,

I am having problems using MSSQL Express with ODBC. I am trying to retrieve a float field from the MSSQL server, but the value I get is corrupted (or at least approximated wrong). For instance, the value I want to retrieve is 59.457443, but what I actually get is 59.457442999999998. This only happens if I connect through ODBC. I did some tracing with ODBC and I've noticed that it's not a problem in my code, since the wrong value is what is actually extracted from the database. Following is an extract from the log file.

a88-ec EXIT SQLGetData with return code 0 (SQL_SUCCESS) HSTMT 03C62918 UWORD 5 SWORD 1 <SQL_C_CHAR> PTR 0x0415EB30 [ 18] "59.457442999999998" SQLLEN 50 SQLLEN * 0x0415E720 (18)


I am wondering if I overlooked something configuration-wise of if this is a bug in the driver? Any help would be greatly appreciated.

EoF

View 4 Replies View Related

MSSQL ODBC Difference Compared To MySQL

Mar 6, 2007

The source for this problem can be found http://www.wellytop.com/SQLProblem.zip

This test creates two threads each with a database connection and uses transactions to insert values into the same table.
The objective of this test is to check that a thread cannot read the results from a pending transaction on a different thread.
In effect this checks dirty reads do not happen and transaction locking.

The test runs correctly and displays "PASSED" with MySQL indicating the transaction and threading worked.
When running with MSSQL Express 2005 it reports a deadlock error during a transaction.
It's not really possible to re-run the transaction and I would like MS SQL to operate similar to MySQL, i.e. MySQL waits for the other transaction to finish before the next transaction can operate on those table rows. I'd like to use MSSQL but I am wondering why this error doesn't happen with MySQL and so have, for the moment, chosen to use it as my preferred database solution.
I have experimented with transaction isolation levels and this doesn't seem to solve the problem.

I've tested this with a fresh install of Windows XP SP2 and no firewall turned on.

To run this test with MSSQL Express2005 use the ODBC Data Source Administrator (odbcad32.exe) to create a data source named MyExpressTest and attach this to an empty database that has been created with the default values. Enable the #define MSSQL in the coude otherwise it tests with MySQL.


To run this test with MySQL (to show how this test should work) use the ODBC Data Source Administrator (odbcad32.exe) to create a data source named mySQLNewTest and attach this to an empty database that has been created with the default values. Comment out the #define MSSQL to switch to MySQL mode.

View 6 Replies View Related

Girl In Need! Anyone Do This: Unix Client -&> ODBC -&> MSSQL Server

Jul 28, 2004

Anyone support a config where you have an unix/linux (AIX here) ODBC client connection to SQL Server database? I am looking for a simple, supportable configuration that does not require me to learn perl or instal a bunch of crap gnu shareware on enterprise class machines.

Please help!

View 2 Replies View Related

MSSQL ODBC (SQL) Connection Issue (sqlstate 2800)

May 27, 2006

I am trying to make an ODBC connection to a MSSQL 2K server on a remote machine. I am using the SQL Server driver and can see the server in the drop down list when asked which server I would like to connect to. I am using SQL authentication over TCP/IP.

The error occurs when ODBC tries to connet to SQL server to obtain the default settings. The error I receive is as follows:

Connection Failed;
sqlstate '28000';
sql server error: 18456;
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'XXXX'

I have tried setting up alternate SQL Server users with varying security rights on the server but am not able to setup the ODBC connection.

I am setting the ODBC connection up on a windows XP SP2 machine.
The remote server is running Windows server 2003 (patched upto date) and MS SQL server 2K (SP3). The connection is over a LAN and does not pass through any firewalls (hardware or software). I can create the ODBC connection without issue locally on the server.

This is my first time creating an ODBC connection to a Windows 2003 Server and I am wondering if there is some additional config I may have missed out.

Many thanks.

View 3 Replies View Related

Distributed Transaction Trough ODBC From MSSQL To Oracle

Apr 14, 2007


I lost few days to solve a problem regarding the connection to an Oracle database server (10) with goal to execute a distributed transaction.

The environment was:

Windows Server 2003 Standard
MSSQL Server 2000 Standard
Oracle 10g Production Edition

The connection was quite easy to make with the Microsoft driver, but the error was:
Server: Msg 7391, Level 16, State 1, Line 3
The operation could not be performed because the OLE DB provider 'MSDAORA' was unable to begin a distributed transaction.
OLE DB error trace [OLE/DB Provider 'MSDAORA' ITransactionJoin::JoinTransaction returned 0x8004d01b].

I tried to use the oracle odbc driver, but all kinds of errors were raised, regarding the TNS name and stuff like this. The real cause was that when you create the linked server you must to check the €œAllow inbound process€? in the provider options.

The Oracle ODBC driver allow distributed transactions.

View 1 Replies View Related

SQL 2000 - Row Level Locking

Jul 20, 2005

Hi,We have encountered deadlock on a table which is used to generatesequential numbers for different categories eg typical entriesCategory ValueTRADE_NO 1456JOB_NO 267.....The applications reference the relevant category applicable to themand updatethe Value accordingly. This is table is very small, occupying 1 page.However, it has no index as it was not seen to be appropriate for atable this size.However, can someone please advise whether1. An index is required for row level locking2. If an index on a table as small as above is likely to reduce thedeadlock rate.Also, please consider the following but which I am not sure isrelevant for above query.We noted that when we migrated the database concerned from SQL 6.5 toSQL 2000, using DTS, that the database was NOT strictly in SQL 2000format for non clustered indexes (NC) ie the clustered key was notpart of the NC index until the clustered index was rebuilt.Given this should I just rebuild this table with a fake index and dropit thereafter.We are aware of the different techniques used to avoid deadlocks (egtables accessed in same order etc) and have , as much as possible,implemented those practices.I thank you in advance for any help you may be able to offer.ThanksPuvendran

View 12 Replies View Related

Problem Due To Locking In MSSQLServer 2000

Jul 15, 2003

Insert or update statements seems to be locking entire page or table rather than locking
the corresponding row to be inserted or updated.

lets assume the table with 3 rows.

scenario 1)
In transaction A, I'm updating the 3'rd row. and in another transaction B I'm reading
row 1.
Transaction B seems to be waiting for transaction A to finish before returning the select results.


Scenario 2)
In transaction A, I'm inserting new row (4'th row) and in another transaction B I'm reading
row 1.
here as well trasaction B does not return the row 1 unless transaction A is complete.
Select operation is blocked due to insert.


Ideally in both the scenarios , read operation should have returned the results without waiting
for update/insert to finish. As the read is being done on different rows than that of being updated
or inserted.
I have tried both the insert/update as well as select queries with all the possible locking hints
such as ROWLOCK, READCOMMITED, UPDLOCK etc...
The only way select query returns the row without blocking is by using the NOLOCK locking hint. But then this is
not the proper solution as it gives us the dirty read.

Please suggest me any solution or workaround for above issue.

View 1 Replies View Related

Attempt To Return Record Set In INSERT...EXEC Statement From ODBC Source(non MSSQL)

Jan 17, 2007

Greeting.

I use OdbcConnection inside clr procedure, for getting data. If I use simple EXEC dbo.clr_proc - all is OK. If I use INSERT...EXEC I recive error message: Distributed transaction enlistment failed.

I set MSDTC security options for No Authentification and Allow inbound and Allow outbound, but it's no use.

Have this problem solution? May be, I must use another method to get my data?



P.S. Linked Servers and OPENQUERY is not applicable. Sybase not describe columns in stored proc result set and one stored proc may return different result set by params.

P.S.S. Sorry for bad english.









View 1 Replies View Related

Vista Business ODBC/DSN To Remote Windows 2000 Server / SQL 2000

Oct 8, 2007

Hi,
Just upgraded some development desktops to Vista Business. However we need
to still connect to some older remote windows 2000/SQL 2000 servers.

Trying to setup an ODBC system DSN on our Vista Business local desktop we get the
following errors -

-START ERROR WINDOW-
Connection Failed:
SQLState: '01000'
SQL Server Error: 772
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen
(SECDoClientHandshake()0.
Connection failed:
SQLState: '08001'
SQL Server Error: 18
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SSL Security Error
-END ERROR WINDOW-

Any help greatly appreciated as this is stopping us from making
database/table connections etc. We've checked the firewall setup and all is well there.

PS - we can still connect fine using XP or windows 2000 desktops and their
local DSNs.

View 8 Replies View Related

Quick SQL Server 2000 Locking Question

Nov 28, 2005

We are running a 3rd party ETL tool to populate a denormailized version of a production database for reports. Everything works fine 95% of the time. However there is a semi-rare occurence of the ETL tool hanging up. The norm is for the tool to take about 5 times longer than usual, but it still works. Over the weekend however it through an error saying:

The SQL Server cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users or ask the system administrator to check the SQL Server lock and memory configuration.

The reports are run through Crystal using stored procs and are all basically select statements

So my question(s) are the following:
1. What kind of lock would a report put on a table (select statement)
2. Would it make sense to change stored procs to use WITH NOLOCK?
3. Or is something else going on?

Your thoughts would be greatly appreciated.

View 5 Replies View Related

Force Row Level Locking In SQLServer 2000 ?

Jul 20, 2005

HiIs it possible to force row level locking in one or more tables insome database. We have some problems when SQL Server decides to choosepage- or table-level locking.We are using SQL Server 2000.Best regardsAarno

View 1 Replies View Related

Conversion Of MSSql 2000 Database To MSSQL 2005 Database

Jan 18, 2008

How to convert a database in MSSQL 2000 to MSSQL 2005 database.Is there any tool or documentation available for this?

View 3 Replies View Related

Recently Updated To Sql 2005 From Sql 2000 Now Recieving Locking Problems

Apr 24, 2008



Good afternoon everyone,

I hope that I am not asking a question which has been answered many times in the past, I did a search but could not find an answer. These may be beginner questions, so bear with me as I am something of a beginner.

This week our organization updated from SQL 2000 to SQL 2005. We are using a Microsoft Access front end for this data and the information is entered through forms into the correct tables. When our researchers are enter the information they also have to sometimes search existing information to ensure they do not duplicate what is already in there. For this we use several access queries. This has worked well on the SQL 2000 server without any issues. However, now that we are on 2005 we are starting to recieve ODBC Call fail errors and errors which specify that they are a result of a deadlock. My first question is, are the ODBC call fail errors possibly locks which caused the ODBC connection to time out? My second question is why am I recieving these errors in 2005 but not 2000?


Thanks in advance for any help

- Hitz

View 1 Replies View Related

SQL Server 2000 - TempDB Problem?

Jan 29, 2006

Hi,

I believe our problem is related to tempDB on the specific server but I would like to know if anybody has come across a similar issue.

We have an SQL statement similar to the following.

BEGIN TRANSACTION

CREATE #tableA

INSERT #tableA SELECT (expression A)

INSERT #tableA SELECT (expression B) WHERE (condition)

COMMIT TRANSACTION

First, let me briefly expand on the second INSERT as this may help when reading the points below.

INSERT #tableA
SELECT ...
FROM ... INNER JOIN tableB
WHERE NOT EXISTS (SELECT ... FROM #tableA WHERE #tableA.columnA = tableB.columnB)

This script works fine on all of our servers except one, which is why I believe tempDB may be involved. After an analysis of the problem, we have the following results,

- If we remove the Transaction, the script succeeds.
- If we leave the Transaction and remove either the first or second INSERT, the script succeeds.

- If we leave the Transaction and both Insert statements and remove the WHERE (condition) from the second Insert, the script succeeds.

- If we reduce the row counts from all source tables concerned by 90%, the script still does not succeed.
- The script had succeeded the week before on the server in question.

Finally, if we replace #tableA with tableA, the script succeeds.

Any help on this would be greatly appreciated.

Thanks.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved