开发者

Problems with a Union Query with an image/varbinary field

I'm having some problems with the following Query:

SELECT  v.idnum
       ,v.full_name
       ,convert(varbinary(max),s.signature)  as Sig
FROM         AppDB.dbo.v_People1 AS v INNER JOIN
                      OtherDB.dbo.Signatures AS s ON v.idnum = s.idnum

UNION

SELECT  v.idnum
   , v.full_name
   , convert(varbinary(max), s.signature) as Sig
FRO开发者_如何学GoM         AppDB.dbo.v_People2 AS v INNER JOIN
                      AppDB.dbo.Signatures AS s ON v.idnum = s.idnum

When i run them each of the queries separately without the union they execute quickly (<5 seconds), but when i run it using the union it's taking forever to execute (infact all it says is executing. I haven't seen it run successfully)

In OtherDB.dbo.Signatures the signature field is a varbinary(max) and in AppDB.dbo.Signatures the field is an image which is why i am using the convert expression. Does anyone know what the problem might be and how i can go about fixing it?

Thanks


I wonder if it's because you are using a UNION instead of a UNION ALL. UNION by itself will remove duplicate rows between the data sets. This may be causing a delay on your blob field. See if there is a difference using UNION ALL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜