Hi Ed,
Thank you for reporting this issue.
I understand that your concern was that there were so many NULL values inserted into the table Group, though there should not be any NULL here.
If I have misunderstood, please let me know.
Based on your script, I performed a test by creating the same tables, adding some test records, and executing your query statement:
=============================
DELETE FROM [Groups];
INSERT INTO [Groups] ([Ticker]
,[HiLowMktCapGrp])
SELECT p.Ticker,
CASE
WHEN r.[Mkt Cap] >= (SELECT MIN([Mkt Cap]) 'Min' FROM (SELECT TOP 45 PERCENT
[Mkt Cap] FROM [RLSP0 Pivot] WHERE [Mkt Cap] IS NOT NULL ORDER BY [Mkt Cap]
DESC) x) THEN 'HiCap'
WHEN r.[Mkt Cap] <= (SELECT MIN([Mkt Cap]) 'Min' FROM (SELECT TOP 55 PERCENT
[Mkt Cap] FROM [RLSP0 Pivot] WHERE [Mkt Cap] IS NOT NULL ORDER BY [Mkt Cap]
DESC) x) THEN 'LoCap'
ELSE CASE p.[TkrType] WHEN 1 THEN NULL WHEN 2 THEN NULL ELSE 'N.A.' END END
AS HiLowMktCapGrp
FROM dbo.[RW Data] AS r RIGHT OUTER JOIN [Parent] p ON r.[Ticker] = p.[Ticker]
===============================
However it successfully completed. After that I executed "SELECT * FROM Groups" and there are no NULL values in the table.
To let me reproduce your issue, could you please mail me (changliw_at_microsoft_dot_com) a test database for reproducing your issue? Appreciate your understanding that it is hard for us to
perform further research if we could not reproduce your issue on this.
If you have any other questions or concerns, please feel free to let me know.
Best regards,
Charles Wang
Microsoft Online Community Support
===========================================================
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: msdnmg.TakeThisOut@microsoft.com.
===========================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx...tificat
Note: The MSDN Managed Newsgroup support offering is for
non-urgent issues where an initial response from the community
or a Microsoft Support Engineer within 1 business day is acceptable.
Please note that each follow up response may take approximately
2 business days as the support professional working with you may
need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
============================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
=========================================================