Problem with over linked server

I have a union view that when I try and access via a linked server connection returns the following message

Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'SQLNCLI' for linked server 'CMPprd' returned data that does not match expected data length for column '[gp9prd].[company].[dbo].[sop10100_sop30200_union].ADDRESS1'. The (maximum) expected data length is 31, while the returned data length is 61.

The interesting thing is that when I look at the union view the column size for the Address1 field says 31 but both Address1 fields in the two tables being unioned have a size of 61.

The union itself has no defined restriction on the field sizes.

I have no problem with the union view except over the Linked server.

Who is Participating?
lcohanConnect With a Mentor Database AnalystCommented:
"The interesting thing is that when I look at the union view..."

I suggest you always CAST/CONVERT all output columns in a VIEW especially in a UNION for linked server - this way you won't have implicit conversion issues in drivers.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.