Rx_
Nothing In Moderation
- Local time
- Yesterday, 18:08
- Joined
- Oct 22, 2009
- Messages
- 2,803
The SQL statement works perfectly in MS Access
There are 2 databases - one SQL Server and Oracle.
One Select statement looks at a Table.Field in SQL Server and a Table.Field in Oracle. It evaluates if they are the same data and returns a True/False under an Alias field name.
Then, several of the alias results are AND together to determine a total Pass/fail.
Not shown - the Where statement filters out only the false (unmatched records).
Problem: in the SQL Server editor - it just won't accept the alias field -- the one with the AND evaluation at the end
There are 2 databases - one SQL Server and Oracle.
One Select statement looks at a Table.Field in SQL Server and a Table.Field in Oracle. It evaluates if they are the same data and returns a True/False under an Alias field name.
Then, several of the alias results are AND together to determine a total Pass/fail.
Not shown - the Where statement filters out only the false (unmatched records).
Problem: in the SQL Server editor - it just won't accept the alias field -- the one with the AND evaluation at the end
Code:
SELECT Wells.[Well_Name],
Wells.DtNavigatorHeadersCreated,
vsrNavigatorSHLBHL.NavSH_QQ,
[vSHLBHL_TopStatus].[SHL QQ] + [vSHLBHL_TopStatus].[SHL QQ2] AS QtrQtrSH,
(Select case when isnull([NavSH_TS_NB],0)= isnull([SHL TWN],0) then 1 else 0 end) as SHTownship,
case when isnull([NavSH_TS_Dir],'')= isnull([SHL TWN2],'') then 1 else 0 end as SHtowndir,
case when isnull([NavSH_RG_Nb],0)= isnull([SHL Range],0) then 1 else 0 end as SHrange,
case when isnull([NavSH_Rg_Dir],'')= isnull([SHL Range2],'') then 1 else 0 end as SHrange2,
case when isnull([NavSH_Sec_NB],0)= isnull([SHL Sect],0) then 1 else 0 end as SHsection,
case when isnull([NavSHVert_Ft],0)= isnull([SHL Ft1],0) then 1 else 0 end as SHverticalfeet,
case when isnull([NavSHVert_AB],'')= isnull([SHL FtFNL],'') then 1 else 0 end as SHverticalfeet1,
case when isnull([NavSHLat_Ft],0)= isnull([SHL Ft2],0) then 1 else 0 end as SHlateralfeet,
case when isnull([NavSHLat_AB],'')= isnull([SHL Ft2FNL],'') then 1 else 0 end as SHlateralfeet1,
case when isnull([SHL QQ] + [SHL QQ2],'')= isnull([NavSH_QQ],'') then 1 else 0 end as shQQ,
-- The above reads a field in SQL and a field in Oracle
-- If they are the same return 0 if not the same return 1
-- later I want to know if all the fields pass/fail a match
-- this would be an example of checking 3 of the fields
(SELECT [SHTownship] AND [shQQ] AND [SHlateralfeet1]) AS SH_Matched,
-- The Alias fields are 0/1 The last select evaluates if all passed (using AND)
-- However the SQL editor doesn't recognize the Alias names - it can't process the Alias name in the same statement
Last edited: