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)
 @@Rowcount issue inside while loop

Author  Topic 

akatech
Starting Member

7 Posts

Posted - 2009-02-11 : 16:07:54
SQL Server 2000 Service Pack 2 - Platform

Using CURSER and While loop to fetch each id in deletecid table:

I am having problem it seems that when there is more than one cusid in the deletecid table the values for the time and rowcount seems to be totaled for all of the cusid's and the value is written to the top record in the output. For some reason as it goes through the while loop it adds to the first output instead of giving me the values per cusid.


The second cusid has values of 0 in the number of records deleted and the time.

I have a table deletecid with one field cusid that holds the customer numbers I want to delete from the database.


ANY HELP WOULD BE APPRECIATED

The deletecid table rows are below:
148
345



OUTPUT:

Current Customer: 148
Table ImageText Customer ID: 148 Number of Records deleted: 8076 Time (seconds): 1116
Table Text Customer ID: 148 Number of Records deleted: 10810 Time (seconds): 731
Table Employee Customer ID: 148 Number of Records deleted: 776 Time (seconds): 16
Table Department- Customer ID: 148 Number of Records deleted: 1540 Time (seconds): 3
Table WOHead - Customer ID: 148 Number of Records deleted: 2019 Time (seconds): 53
Table WODelete - Customer ID: 148 Number of Records deleted: 25 Time (seconds): 2
Table WODetail - Customer ID: 148 Number of Records deleted: 0 Time (seconds): 0
Table Customer - Customer ID: 148 Number of Records deleted: 2 Time (seconds): 2
Table Services - Customer ID: 148 Number of Records deleted: 174 Time (seconds): 5
Current Customer: 345
Table ImageText Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Text Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Employee Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Department- Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table WOHead - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table WODelete - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table WODetail - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Customer - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Services - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0





CREATE PROCEDURE deletecustomerKH AS
BEGIN
-- Declare the variables to store the values returned by FETCH.

DECLARE @cuid varchar(50)

--Declare the variable times to be held

declare @t1 datetime, @t2 datetime, @t3 datetime, @t4 datetime, @t5 datetime, @t6 datetime
declare @t7 datetime, @t8 datetime, @t9 datetime, @t10 datetime, @t11 datetime, @t12 datetime
declare @t13 datetime, @t14 datetime, @t15 datetime, @t16 datetime, @t17 datetime, @t18 datetime

--Declare the variables to hold the time difference

declare @tim1 int, @tim2 int, @tim3 int, @tim4 int, @tim5 int, @tim6 int, @tim8 int, @tim9 int, @tim10 int

--Declare the variables to hold the row count for each delete statement

declare @rcount1 int, @rcount2 int, @rcount3 int, @rcount4 int, @rcount5 int, @rcount6 int, @rcount8 int, @rcount9 int, @rcount10 int

--Declare the variabel to hold the output to file statement

DECLARE @cmd varchar(300), @cmd2 varchar(300), @cmd3 varchar(300), @cmd4 varchar(300), @cmd5 varchar(300), @cmd6 varchar(300), @cmd7 varchar(300), @cmd8 varchar(300), @cmd9 varchar(300), @cmd10 varchar(300)


DECLARE contact_cursor CURSOR FOR
SELECT cusid FROM deletecid

OPEN contact_cursor

-- Perform the first fetch and store the values in variables.
-- Note: The variables are in the same order as the columns
-- in the SELECT statement.

FETCH NEXT FROM contact_cursor
INTO @cuid

-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN

set @rcount1 = 0
set @tim1 = 0

set @t1 = getdate()

DELETE trImageText
FROM trImageText JOIN trItem ON trImageText.TableID =
trItem.trItemID INNER JOIN
deletecid ON trItem.trCustomerID = deletecid.cusid

set @rcount1 = @@rowcount

set @t2 = getdate()
set @tim1 = datediff(second,@t1,@t2)




SET @cmd7 = 'echo Current Customer: ' + @cuid + ' >> c:\Output\deletedrecords.txt'
SET @cmd = 'echo Table ImageText Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount1 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim1 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd7
EXEC master..xp_cmdshell @cmd


set @rcount2 = 0
set @tim2 = 0

set @t3 = getdate()

DELETE trItem
FROM trItem JOIN deletecid ON trItem.trCustomerID = deletecid.cusid

set @rcount2 = @@rowcount

set @t4 = getdate()
set @tim2 = datediff(second,@t3,@t4)




SET @cmd2 = 'echo Table Text Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount2 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim2 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd2


set @rcount3 = 0
set @tim3 = 0


set @t5 = getdate()

DELETE trEmployee
FROM trEmployee JOIN deletecid ON trEmployee.trcustomerid =
deletecid.cusid

set @rcount3 = @@rowcount

set @t6 = getdate()
set @tim3 = datediff(second,@t5,@t6)




SET @cmd3 = 'echo Table Employee Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount3 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim3 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd3


set @rcount4 = 0
set @tim4 = 0

set @t7 = getdate()

DELETE trDepartment
FROM trDepartment JOIN deletecid ON trDepartment.trcustomerid =
deletecid.cusid

set @rcount4 = @@rowcount

set @t8 = getdate()
set @tim4 = datediff(second,@t7,@t8)




SET @cmd4 = 'echo Table Department- Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount4 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim4 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd4


set @rcount8 = 0
set @tim8 = 0

set @t13 = getdate()

DELETE trWOHead
FROM trWOHead JOIN deletecid ON trWOHead.trcustomerid = deletecid.cusid

set @rcount8 = @@rowcount

set @t14 = getdate()
set @tim8 = datediff(second,@t13,@t14)


SET @cmd8 = 'echo Table WOHead - Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount8 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim8 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd8


set @rcount9 = 0
set @tim9 = 0

set @t15 = getdate()

DELETE trWODelete
FROM trWODelete JOIN deletecid ON trWODelete.trcustomerid = deletecid.cusid


set @rcount9 = @@rowcount

set @t16 = getdate()
set @tim9 = datediff(second,@t15,@t16)


SET @cmd9 = 'echo Table WODelete - Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount9 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim9 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd9


set @rcount10 = 0
set @tim10 = 0

set @t17 = getdate()

DELETE trWODetail
FROM trWODetail JOIN trItem ON trWODetail.tritemid = trItem.trItemID INNER JOIN deletecid ON trItem.trCustomerID = deletecid.cusid


set @rcount10 = @@rowcount

set @t18 = getdate()
set @tim10 = datediff(second,@t17,@t18)


SET @cmd10 = 'echo Table WODetail - Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount10 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim10 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd10


set @rcount5 = 0
set @tim5 = 0

set @t9 = getdate()

DELETE trCustomer
FROM trCustomer JOIN deletecid ON trCustomer.trcustomerid =
deletecid.cusid

set @rcount5 = @@rowcount

set @t10 = getdate()
set @tim5 = datediff(second,@t9,@t10)


SET @cmd5 = 'echo Table Customer - Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount5 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim5 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd5

set @rcount6 = 0
set @tim6 = 0

set @t11 = getdate()

DELETE trServices
FROM trServices JOIN deletecid ON trServices.trcustomerid =
deletecid.cusid

set @rcount6 = @@rowcount

set @t12 = getdate()
set @tim6 = datediff(second,@t11,@t12)


SET @cmd6 = 'echo Table Services - Customer ID: '+ @cuid + ' Number of Records deleted: ' + CAST(@rcount6 AS varchar(10)) + ' Time (seconds): ' + CAST(@tim6 AS varchar(20)) + ' >> c:\Output\deletedrecords.txt'
EXEC master..xp_cmdshell @cmd6



-- This is executed as long as the previous fetch succeeds.
FETCH NEXT FROM contact_cursor
INTO @cuid
END

CLOSE contact_cursor
DEALLOCATE contact_cursor

END

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-11 : 16:46:46
Didn't we just have this discussion over at www.dbforums.com?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

akatech
Starting Member

7 Posts

Posted - 2009-02-11 : 16:54:43
Yes, but the last post from someone said they did not have experience with curser so they couldn't help so I thought I could get help from another forum - are the same people on all the forums, I am new to sql and posting on forums
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-11 : 17:12:58
Well... Where should I start?

See [all] your delete statements!

DELETE trImageText 
FROM trImageText JOIN trItem ON trImageText.TableID =
trItem.trItemID INNER JOIN
deletecid ON trItem.trCustomerID = deletecid.cusid
As you can see, you join against deleteCID table, FOR ALL VALUES!
WHY? For every delete, you delete for all values in deleteCID table.

You already have the "working" id in the @cuID variable, so there is no need to join the deleteCID table. Period!
This statement
DELETE trImageText 
FROM trImageText JOIN trItem ON trImageText.TableID =
trItem.trItemID INNER JOIN
deletecid ON trItem.trCustomerID = deletecid.cusid
should read
DELETE trImageText 
FROM trImageText JOIN trItem ON trImageText.TableID =
trItem.trItemID
WHERE trItem.trCustomerID = @cuID
As you can see, this has NOTHING to do with CURSORS.
It is a mental breakdown on how JOIN works.

Change all your DELETE statement according to the one depicted above!



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-11 : 17:20:46
Like this
--------------------------------------------------------------------------------

--DELETE trImageText
--FROM trImageText JOIN trItem ON trImageText.TableID =
--trItem.trItemID INNER JOIN
--deletecid ON trItem.trCustomerID = deletecid.cusid


DELETE w
FROM trImageText AS w
INNER JOIN trItem ON trItem.trItemID = w.TableID
WHERE trItem.trCustomerID = @cuID

--------------------------------------------------------------------------------

--DELETE trItem
--FROM trItem JOIN deletecid ON trItem.trCustomerID = deletecid.cusid


DELETE
FROM trItem
WHERE trCustomerID = @cuID

--------------------------------------------------------------------------------

--DELETE trEmployee
--FROM trEmployee JOIN deletecid ON trEmployee.trcustomerid =
--deletecid.cusid


DELETE
FROM trEmployee
WHERE trcustomerid = @cuID

--------------------------------------------------------------------------------

--DELETE trDepartment
--FROM trDepartment JOIN deletecid ON trDepartment.trcustomerid =
--deletecid.cusid


DELETE
FROM trDepartment
WHERE trcustomerid = @cuID

--------------------------------------------------------------------------------

--DELETE trWOHead
--FROM trWOHead JOIN deletecid ON trWOHead.trcustomerid = deletecid.cusid


DELETE
FROM trWOHead
WHERE trcustomerid = @cuID

--------------------------------------------------------------------------------

--DELETE trWODelete
--FROM trWODelete JOIN deletecid ON trWODelete.trcustomerid = deletecid.cusid


DELETE
FROM trWODelete
WHERE trcustomerid = @cuID

--------------------------------------------------------------------------------

--DELETE trWODetail
--FROM trWODetail JOIN trItem ON trWODetail.tritemid = trItem.trItemID INNER JOIN deletecid ON trItem.trCustomerID = deletecid.cusid


DELETE w
FROM trWODetail AS w
INNER JOIN trItem ON trItem.trItemID = w.tritemid
WHERE trItem.trCustomerID = @cuID

--------------------------------------------------------------------------------

--DELETE trCustomer
--FROM trCustomer JOIN deletecid ON trCustomer.trcustomerid =
--deletecid.cusid


DELETE
FROM trCustomer
WHERE trcustomerid = @cuID

--------------------------------------------------------------------------------

--DELETE trServices
--FROM trServices JOIN deletecid ON trServices.trcustomerid =
--deletecid.cusid


DELETE
FROM trServices
WHERE trcustomerid = @cuID

--------------------------------------------------------------------------------



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

akatech
Starting Member

7 Posts

Posted - 2009-02-11 : 17:35:16
OK I understand what you are saying and I will make the change for the JOIN in each statement, but the main problem I am having is that after all the delete statements have been excecuted with the first @cuid the values in my

@@rowcount and

the values from set @t1 = getdate() , set @t2 = getdate()
set @tim1 = datediff(second,@t1,@t2)

are not getting reset to zero before each statement for the next @cuid in the while loop, instead it is being added to the first @cuid values.

OUTPUT:

Current Customer: 148
Table ImageText Customer ID: 148 Number of Records deleted: 8076 Time (seconds): 1116
Table Text Customer ID: 148 Number of Records deleted: 10810 Time (seconds): 731
Table Employee Customer ID: 148 Number of Records deleted: 776 Time (seconds): 16
Table Department- Customer ID: 148 Number of Records deleted: 1540 Time (seconds): 3
Table WOHead - Customer ID: 148 Number of Records deleted: 2019 Time (seconds): 53
Table WODelete - Customer ID: 148 Number of Records deleted: 25 Time (seconds): 2
Table WODetail - Customer ID: 148 Number of Records deleted: 0 Time (seconds): 0
Table Customer - Customer ID: 148 Number of Records deleted: 2 Time (seconds): 2
Table Services - Customer ID: 148 Number of Records deleted: 174 Time (seconds): 5
Current Customer: 345
Table ImageText Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Text Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Employee Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Department- Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table WOHead - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table WODelete - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table WODetail - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Customer - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0
Table Services - Customer ID: 345 Number of Records deleted: 0 Time (seconds): 0


THERE SHOULD BE VALUES IN THE NUMBER OF RECORDS DELETED AND TIME FOR EACH STATEMENT IN CUSTOMER ID 345.

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-11 : 17:39:56
quote:
Originally posted by akatech

THERE SHOULD BE VALUES IN THE NUMBER OF RECORDS DELETED AND TIME FOR EACH STATEMENT IN CUSTOMER ID 345.
No! Not with your flawed code above.
ALL records are deleted in first iteration, both CustomerID 148 and 345, because you JOIN the table on which you have a cursor.
The cursor is not used at all.
When looping into second iteration all records for 345 are already deleted, so there are no more records to delete and the delete statement takes very little time, just under one second.
And the number of deletes in first iteration are the combined number of deletes for both 148 and 345 customers.

This is how your stored procedure should look like!
CREATE PROCEDURE dbo.usp_DeleteCustomerKH
AS

SET NOCOUNT ON

DECLARE @cuID VARCHAR(50),
@dt DATETIME,
@rc INT,
@cmd VARCHAR(300)

DECLARE curContact CURSOR FAST_FORWARD READ_ONLY FOR
SELECT cusID
FROM deleteCID

OPEN curContact

FETCH NEXT
FROM curContact
INTO @cuID

WHILE @@FETCH_STATUS = 0
BEGIN
SET @cmd = 'echo Current Customer: ' + @cuID + ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE w
FROM trImageText AS w
INNER JOIN trItem ON trItem.trItemID = w.TableID
WHERE trItem.trCustomerID = @cuID

SET @cmd = 'echo Table ImageText Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE w
FROM trWODetail AS w
INNER JOIN trItem ON trItem.trItemID = w.tritemid
WHERE trItem.trCustomerID = @cuID

SET @cmd = 'echo Table WODetail Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE
FROM trWOHead
WHERE trcustomerid = @cuID

SET @cmd = 'echo Table WOHead Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE
FROM trWODelete
WHERE trcustomerid = @cuID

SET @cmd = 'echo Table WODelete Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE
FROM trItem
WHERE trCustomerID = @cuID

SET @cmd = 'echo Table Item Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE
FROM trEmployee
WHERE trcustomerid = @cuID

SET @cmd = 'echo Table Employee Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE
FROM trDepartment
WHERE trcustomerid = @cuID

SET @cmd = 'echo Table Department Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE
FROM trCustomer
WHERE trcustomerid = @cuID

SET @cmd = 'echo Table Customer Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

SET @dt = GETDATE()

DELETE
FROM trServices
WHERE trcustomerid = @cuID

SET @cmd = 'echo Table Services Customer ID: ' + @cuID
+ ' Number of Records deleted: ' + CAST(@@ROWCOUNT AS VARCHAR(11))
+ ' Time (seconds): ' + CAST(DATEDIFF(SECOND, @dt, GETDATE()) AS VARCHAR(11))
+ ' >> c:\Output\deletedrecords.txt'

EXEC master..xp_cmdshell @cmd

FETCH NEXT
FROM curContact
INTO @cuID
END

CLOSE curContact
DEALLOCATE curContact
This looks neater and will perform as you want.
I also made some changes in the deleting order for better sake, because you deleted from trItem table first and then later joined that table when deleting from WODetail table. And such, there might not be records left to join against.

Use this and take the time to study the suggestion and learn.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

akatech
Starting Member

7 Posts

Posted - 2009-02-11 : 19:21:04
I cannot Thank You enough ... Your code fixes worked like a charm gave and is giving me the exact output I was looking for.

After taking some time to read through your code and the structure I fully understand now why the output was not correct. I have worked many hours the last few days with no solution.

Also I notice the code executes twice as fast as before. Thanks again much appreciated. I can now delete 700 customers from the database and give an output of what was deleted and how long it took to delete each customer.


OUTPUT:
Current Customer: 1688
Table ImageText Customer ID: 1688 Number of Records deleted: 0 Time (seconds): 0
Table Item Customer ID: 1688 Number of Records deleted: 0 Time (seconds): 0
Table Employee Customer ID: 1688 Number of Records deleted: 35 Time (seconds): 0
Table Department Customer ID: 1688 Number of Records deleted: 3 Time (seconds): 0
Table WODetail Customer ID: 1688 Number of Records deleted: 0 Time (seconds): 0
Table WOHead Customer ID: 1688 Number of Records deleted: 0 Time (seconds): 0
Table WODelete Customer ID: 1688 Number of Records deleted: 0 Time (seconds): 0
Table Customer Customer ID: 1688 Number of Records deleted: 1 Time (seconds): 1
Table Services Customer ID: 1688 Number of Records deleted: 87 Time (seconds): 0
Current Customer: 1700
Table ImageText Customer ID: 1700 Number of Records deleted: 8 Time (seconds): 2
Table Item Customer ID: 1700 Number of Records deleted: 101 Time (seconds): 6
Table Employee Customer ID: 1700 Number of Records deleted: 39 Time (seconds): 0
Table Department Customer ID: 1700 Number of Records deleted: 5 Time (seconds): 0
Table WODetail Customer ID: 1700 Number of Records deleted: 0 Time (seconds): 0
Table WOHead Customer ID: 1700 Number of Records deleted: 24 Time (seconds): 1
Table WODelete Customer ID: 1700 Number of Records deleted: 0 Time (seconds): 0
Table Customer Customer ID: 1700 Number of Records deleted: 1 Time (seconds): 0
Table Services Customer ID: 1700 Number of Records deleted: 87 Time (seconds): 1
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-12 : 00:40:18
And if you keep the order of DELETEs as I suggested, you will be deleting records from WODetail table also...

Good luck.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -