Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Linked Server Error while executing a stored procedure Expand / Collapse
Author
Message
Posted Monday, September 28, 2009 4:56 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 4, 2010 5:44 PM
Points: 8, Visits: 53
Dear All,

Scenario:

Server A has a stored procedure which has three select statements. Execution of the stored procedure will return a dataset of three tables

e.g. Select col1, col2 from tableA AA joins LinkedServer.DB.dbo.TableB BB on AA.ID = BB.ID

Select col1, col2 from tableA AA joins LinkedServer.DB.dbo.TableB BB on AA.ID = BB.ID

Select col1, col2 from tableA AA joins LinkedServer.DB.dbo.TableB BB on AA.ID = BB.ID


The joins in the above statements also includes tables in the local server.

Problem:

The execution of the SP creates issues while executing the second select statement. If the second select statement does return some rows, then it fails giving the below error message:

OLE DB provider "SQLNCLI" for linked server "LNK1" returned message "String data, length mismatch".
Msg 7421, Level 16, State 2, Line 7
Cannot fetch the rowset from OLE DB provider "SQLNCLI" for linked server "LNK1". .

If the second select statement does not return any rows, then the SP execution is successful.
The rows returned in the second query depends on the data present within a local table included in the join. The first query does not matter in context of whether it returns any rows or not.

Also, if the first query does not return any rows, and the second query returns rows, the SP execution is successful.

Is anyting dependent on the number of rows returned while grabbing data from a linked server.. OR anything in this context.

Can anyone please help. I am stuck in the middle of doing something on this.

Any help would be appreciated.
Thanks.

Regards,
Post #794827
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse