Linked Table Blocks Truncate Operation (1 Viewer)

WayneRyan

AWF VIP
Local time
Today, 08:39
Joined
Nov 19, 2002
Messages
7,122
I have an Access Front-End with one SQL Server table linked.

There is a stored procedure that performs two operations:

1) Truncate Table ThatTable
2) Insert Into ThatTable Select * From ...

If the Access front-end is open, the process that presides over the linked
table "blocks" the stored procedure's Truncate operation. The Truncate
Table operation never completes.

If the Truncate Table is replaced with "Delete From ThatTable", then all
is well.

Anyone have any ideas on this?

Thanks,
Wayne
 

WayneRyan

AWF VIP
Local time
Today, 08:39
Joined
Nov 19, 2002
Messages
7,122
Banana,

Yes, if Access is open at all, that process blocks the process that issues
the Truncate. Enterprise Manager shows it.

The "Delete From ..." syntax works fine though.

This contention for the table just seems funny.

Wayne
 

Banana

split with a cherry atop.
Local time
Today, 00:39
Joined
Sep 1, 2005
Messages
6,318
I quite agree. It was bizarre.

But to be 100% sure. Does Access still block truncation even if the form containing the table in question isn't open at all? At least I remember when I was dealing with that problem myself, it only happens if the subform is opened against the table I was trying to truncate.
 

WayneRyan

AWF VIP
Local time
Today, 08:39
Joined
Nov 19, 2002
Messages
7,122
Banana,

The Access front-end just has to be open.

It doesn't interfere with the "Delete From ...".

Oh well, live and learn.

Wayne
 

Banana

split with a cherry atop.
Local time
Today, 00:39
Joined
Sep 1, 2005
Messages
6,318
Interesting. Not quite same situation as was with my which only required that the subform in question be closed.

Maybe, are you holding a persistent connection?
 

WayneRyan

AWF VIP
Local time
Today, 08:39
Joined
Nov 19, 2002
Messages
7,122
Banana,

No persistent connection.

It's just weird as to why the Truncate command (which has no administrative "overhead") doesn't work at all, whereas the
"Delete From ..." (which has many more restrictions) works fine.

Sometimes I just want to know how these things think.

Thanks,
Wayne
 

Banana

split with a cherry atop.
Local time
Today, 00:39
Joined
Sep 1, 2005
Messages
6,318
Very curious.

I'm grasping for straws here, but I wonder if it's related to the table being linked? That is, if that table in question is removed from the Access, will the command work then?

Even if that was what was needed, I don't see it as a practical solution. I really, really wish I knew why TRUNCATE TABLE would not work in your situation as it hasn't in my situation.
 

WayneRyan

AWF VIP
Local time
Today, 08:39
Joined
Nov 19, 2002
Messages
7,122
Banana,

Sorry, but I had to get back to work in order to see this, it's not really
even my app.

The Linked Table is the RowSource for a Listbox on a form. Whenever the
form is open, the Truncate is blocked.

If Access is open (but NO form), all is well.

Just a quirk I guess.

Thanks again,
Wayne
 

Banana

split with a cherry atop.
Local time
Today, 00:39
Joined
Sep 1, 2005
Messages
6,318
Yes, I do think it's definitely a quirk or even a bug but now it fits the pattern I was expecting: if you have a form(s) open that has a recordsource or rowsource binding that table in question, then Truncate Table just won't work. I have to dig up my old project but I *think* I worked around that by setting the subform's SourceObject (or was it recordsource?) to ZLS before executing the query then restoring the the property.
 

WayneRyan

AWF VIP
Local time
Today, 08:39
Joined
Nov 19, 2002
Messages
7,122
Banana,

Thanks again.

The table is bound to a ListBox. During execution of the SP I agree that
setting the ListBox's RowSource to a ZLS should work fine.

Wayne
 

Users who are viewing this thread

Top Bottom