SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Strange union query failure
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

GustiX
Starting Member

Iceland
26 Posts

Posted - 07/14/2012 :  20:13:52  Show Profile  Reply with Quote
Hi

I have a stored procedure that has a cursor with a union query statement, something like:

declare DEMO cursor for
select col1 from table1
union
select col2 from table2
fetch next ... and so on

It appears that sometimes when the procedure is run
I only get half of the expected records (only from table2)
Is it possible if there is a deadlock (or something blocking
the select statement from table1) that a union query would only
give the results from the bottom half of a union query?

I would think that if something is blocking the top half
of the union query that it would just fail... ???

visakh16
Very Important crosS Applying yaK Herder

India
47099 Posts

Posted - 07/14/2012 :  22:51:27  Show Profile  Reply with Quote
hmm...not something i've seen so far. try this variant and see if you can reproduce same error

declare DEMO cursor for
select col
from
(
select col1 as col from table1
union
select col2 from table2
)t
fetch next ... 


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000