Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, May 20, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Data & Imports Forums - T-SQL & Queries
Forum to discuss general T-SQL questions and help with queries related to SalesLogix data. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to T-SQL & Queries | New ThreadView:  Search:  
 Author  Thread: SQL 2000 - TRANSACTIONS and LOCKS-- HELP !
Veronka Capone
Posts: 113
 
SQL 2000 - TRANSACTIONS and LOCKS-- HELP !Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Dec 07 9:07 AM
I have created a sp to update aprox 50 tables on 2 different DB. I put all update statements in a transaction, to rollback tran if any error is raised.
The stored procedure works fine in QueryAnalyzer.

I am calling the same sp within .NET 2.0 WinApp (using the same credentials as in QA) and my sp fails with the following message 'String or binary data would be truncated. The statement has been terminated.'

I followed the sp execution through SQL Profiler... i see a lots of locks acquired but none released ... and then i get the error. I cannot see COMMINT OR ROLLBACK being executed. It seems it stops in the middle of the sp.

Does numbers of lock plays any role into this? -- this is just a wild guess ??
I have no idea how to debug/fix this. Can anyone help me with this?


The logic in my usp is:

CREATE PROCEDURE usp_ADM_ChangeCustID
@OldCustID varchar(10),
@NewCustID varchar(10)

AS
BEGIN
SET NOCOUNT ON


DECLARE @Err int
DECLARE @ErrorDesc varchar(250)

SET @ErrorCode = 0
SET @ErrorDesc = 'Success'

BEGIN TRAN

UPDATE AAAAAA SET externalaccountno = @NewCustID WHERE externalaccountno = @OldCustID
SET @err = @@ERROR
IF @err <> 0
BEGIN
RAISERROR('Error while updating table AAA field aaa',16,1)
GOTO HANDLE_ERROR
END

..... many more tables here .............


UPDATE ZZZZZ SET customer_id = @NewCustID, date_last_updt = @UpdateDate WHERE customer_id = @OldCustID
SET @err = @@ERROR
IF @err <> 0
BEGIN
RAISERROR('Error while updating table ZZZZ field zzz,16,1)
GOTO HANDLE_ERROR
END


IF @err = 0
COMMIT TRAN

HANDLE_ERROR:
IF @err <> 0
BEGIN
ROLLBACK TRAN
SET @ErrorCode = @err
SET @ErrorDesc = (SELECT Description from master..sysmessages
WHERE msgLangID = 1033
AND error = @err)
END

SELECT
@ErrorCode AS ErrorCode,
@ErrorDesc AS ErrorDesc


SET NOCOUNT OFF
END

[Reply][Quote]
Veronka Capone
Posts: 113
 
Re: SQL 2000 - TRANSACTIONS and LOCKS-- HELP !Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Dec 07 11:39 AM
I solved this problem by reducing the number of statements in the transaction.

Anyone knows why?
[Reply][Quote]
Ted Sturr
Posts: 78
 
Re: SQL 2000 - TRANSACTIONS and LOCKS-- HELP !Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Dec 07 8:22 AM
Just so everyone else knows, we figured out the problem. There were triggers on the underlying table. When you run a group of updates through ADO we ran into issues. We needed to add these statements to the top and bottom of the sp to make it work properly:

ALTER TABLE DEMOESI..sofcm DISABLE TRIGGER all

ALTER TABLE DEMOESI..sofcm ENABLE TRIGGER all

Also, just so I don't get "called" on this, we are not going to use the sp to do the updates on the SLX tables. Those will be handled through the OLEDB provider to allow for sync traffic.

Ted
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 5/20/2024 11:29:32 PM