Experts Round Table Network
Navigate
Home
ArticleWiki
Forum
Newsletter
Links
Tech News
Welcome Guest.
Username:
Password:
Remember me
Forgot your password?
Register
Problem with query on a view created by a union
Welcome,
Guest
. Please
login
or
register
.
February 07, 2012, 05:37:47 AM
11513
Posts in
1262
Topics by
496
Members
Latest Member:
Beerdernill
Home
Help
Search
Login
Register
Experts Round Table Network
|
Databases
|
MS SQL Server
|
Problem with query on a view created by a union
« previous
next »
Pages:
[
1
]
Print
Author
Topic: Problem with query on a view created by a union (Read 1371 times)
Carlo
Offline
Posts: 1
Problem with query on a view created by a union
«
on:
June 27, 2006, 07:16:43 AM »
Hi,
I have a view V1 created as a plain UNION from 2 tables:
SELECT * FROM T1
UNION
SELECT * FROM T2
If I create another view V2 just filtering V1 through a WHERE clause (e.g. SELECT * FROM V1 WHERE x < y) I don't get any rows returned.
However, if I write the SELECT clause within each branch of the former UNION, I correctly get all the rows.
Is this a known bug of SQL Server 2000? If yes, is there a SP fixing it?
thx,
smiley61
Logged
Kevin3NF
Moderator
Offline
Posts: 12
Problem with query on a view created by a union
«
Reply #1 on:
June 27, 2006, 08:57:17 AM »
Hello Carlo/Smiley61,
Can you please post the current SP level you are on?
If possible, please also post the CREATE TABLE statements and some inserts to populate them.
Lastly, ifyou post the query that does work, that will help give a basis for comparison.
To answer the direct question, I am not aware of any issues surrounding this but will be happy to look.
Thanks,
Kevin3NF
Logged
For the love of Pete...include the version of the software you are using in your question :-)
Carlo
Offline
Posts: 1
Problem with query on a view created by a union
«
Reply #2 on:
June 27, 2006, 09:04:52 AM »
I apologize for forgetting version details.
The problem has occurred on SQL Server 2000 Standard Edition SP4 (build 8.00.2039).
Actually we have noticed something else, in the meanwhile, that may be useful.
The problem happens when the UNION is between 2 tables with a very large number of columns.
After that we have seen that at a certain point SQL Server shifts the content of the columns by 1. That means that the column labeled 56 still exists but its content is now under column 57, and so on.
Which explain why the successive query does not return any result.
thx again for helping,
Carlo
Logged
Kevin3NF
Moderator
Offline
Posts: 12
Problem with query on a view created by a union
«
Reply #3 on:
June 27, 2006, 09:12:07 AM »
A follow-up...
Are you actually using Select * From...or was that just for example here?
I'd love to know more about what this means:
"After that we have seen that at a certain point SQL Server shifts the content of the columns by 1. That means that the column labeled 56 still exists but its content is now under column 57, and so on"
If you have the time...
Thanks,
Kevin3NF
Logged
For the love of Pete...include the version of the software you are using in your question :-)
COBOLdinosaur
ERT.com Admin
Offline
Posts: 481
Problem with query on a view created by a union
«
Reply #4 on:
June 27, 2006, 06:09:04 PM »
I'd like to hear about that as well. It sounds like really strange behavour. :scratch:
Logged
NeoTeq
Offline
Posts: 21
Re: Problem with query on a view created by a union
«
Reply #5 on:
July 16, 2006, 04:14:37 PM »
No, it's behavior that sounds familiar to me too. I've had similar problems when creating views where I did a SELECT * FROM, whether in UNION or not. So, it would be very interesting to know if the problem still exists when selecting specific columns. This method always solved the problem on my end.
I'm also on SQL Server 2000 SP 4.
Logged
Still claiming: There is no peace.
Pages:
[
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
ERT 1.5
-----------------------------
=> Round Table Learning Center
=> Bug reports
-----------------------------
Legacy
-----------------------------
=> The next level
=> History of ERT
-----------------------------
Community Affairs
-----------------------------
=> Introductions
=> Ballot Box
===> Closed Polls
=> Soapbox
===> 2006
=> Propose and Consult
===> Propose and Consult...CLOSED
-----------------------------
Bits and Bytes
-----------------------------
=> Tips, Tricks, Snippets, Tidbits And General Pearls Of Wisdom
-----------------------------
Serverside Technology
-----------------------------
=> PHP
=> ASP
-----------------------------
Webservers
-----------------------------
=> Apache
=> IIS
-----------------------------
Databases
-----------------------------
=> MySQL
=> Access
=> MS SQL Server
-----------------------------
Clientside Technology
-----------------------------
=> HTML
=> CSS
=> Javascript
=> Flash
=> WAP/WML
-----------------------------
Web Technologies
-----------------------------
=> General Web Dev
=> Web Standards
=> XML
=> Online Marketing
-----------------------------
Graphics
-----------------------------
=> Graphics Design and Animation
-----------------------------
Programming
-----------------------------
=> .NET
=> JAVA
=> MS DOS Batch Scripting
=> Mathematics
=> C & C++
=> VB
=> Delphi
=> Algorithm design
-----------------------------
Operating Systems
-----------------------------
=> Windows (General)
=> NT Based (2K, 2K-03, NT, XP, Vista)
=> Open Source (All)
-----------------------------
Hardware
-----------------------------
=> Hardware General
===> 2006
===> 2007
=> Gamers Hardware (Advanced)
-----------------------------
Networking
-----------------------------
=> Home (small)
=> Office (large)
=> Internet
-----------------------------
Security
-----------------------------
=> General Security Issues
-----------------------------
Rants/Opinions/Proposals
-----------------------------
=> Site operation
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media
Joomla Bridge by
JoomlaHacks.com