SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Linked Server Error while executing a stored procedure


Linked Server Error while executing a stored procedure

Author
Message
meandnayan
meandnayan
SSC Rookie
SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)

Group: General Forum Members
Points: 32 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,
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search