Showing posts with label populating. Show all posts
Showing posts with label populating. Show all posts

Wednesday, March 21, 2012

Problem populating temp table from linked server.

Hello,

I have a 2000 sql server linked to a 2005 sql server an I am trying to return data across the link. If I just run the sp I get the data back fine but if I try to Insert the data into a temp table the process just hangs and has to be killed.

This works fine:

EXEC [MyLink].[MyDocs].[dbo].[spGetSearchWrapper] -- (returns 156k records in about 2 sec.)

However inserting the results into a local temp table never returns. In fact the process never really runs.

CREATE TABLE #tmpOrgResult
(
intObjectID INT NOT NULL,
intObjectTypeCodeID INT NOT NULL

)
GO

-- Insert org records that match the search.
INSERT INTO #tmpOrgResult
(
intObjectID,
intObjectTypeCodeID
)
EXEC [MyLink].[MyDocs].[dbo].[spGetSearchWrapper] -- (This statement just hangs)

Try with

SET REMOTE_PROC_TRANSACTIONS OFF

before the INSERT statement. What I suspect happens is the local transaction is promoted to a distributed one and something gets messed up.

Zlatko

|||

You are correct it is getting promoted to a distributed transaction. Turns out MSDTC was off by default on the server. The following article showed me how to enable it. Works like a champ now.

http://support.microsoft.com/?kbid=873160

|||You are welcome.

Problem populating table with a cursor from VB GUI

Hi all
I have a store proc that that does various bits of data manipulation, but
the last part I have used a cursor to update 2 fields in a table. This sp i
s
called by a VB front end and then the contents of the table in question
displayed.
The problem is, if I run the sp directly (within VB's Server Explorer) these
2 fields are always fully populated. If however I call the sp from within
code in a GUI, after each call (which should fully populate the table based
on certain criteria) the 2 fields become less populated. What I mean by thi
s
is on the 1st call the 2 fields are 100% populated, with each subsequent cal
l
only populating maybe 50% of records, then 20%, until no records are
populated.
Would anyone have any ideas where I may look.
thanks"Chubbly Geezer" <ChubblyGeezer@.discussions.microsoft.com> wrote in message
news:1BE8A023-7631-49AA-85BC-E5FD5808EF00@.microsoft.com...
> Hi all
> I have a store proc that that does various bits of data manipulation, but
> the last part I have used a cursor to update 2 fields in a table. This sp
is
> called by a VB front end and then the contents of the table in question
> displayed.
> The problem is, if I run the sp directly (within VB's Server Explorer)
these
> 2 fields are always fully populated. If however I call the sp from within
> code in a GUI, after each call (which should fully populate the table
based
> on certain criteria) the 2 fields become less populated. What I mean by
this
> is on the 1st call the 2 fields are 100% populated, with each subsequent
call
> only populating maybe 50% of records, then 20%, until no records are
> populated.
> Would anyone have any ideas where I may look.
> thanks
If you post the code and any necessary DDL, we can give you a lot better
answer.
From the limited information you have provided, I would guess that your VB6
application may be timing out. Then again, without any idea of what is
really going on in the sproc, it's hard to say.
Rick Sawtell
MCT, MCSD, MCDBA