House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

SQL Help

  << Previous Post |  RSS |  Subscribe to this Group Next >> 

SQL Help

I'm having a weird query issue with SQL server... Rick Root 10/24/2007 11:46 AM

10/24/2007 11:46 AM
Author: Rick Root Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54008#291974 I'm having a weird query issue with SQL server... The following query inserts two rows into the query_results table: ------------------------------------------------------------ insert into ENQUIRE.dbo.QUERY_RESULTS ( QUERYID, ENTITY_ID ) SELECT DISTINCT 1933 AS QUERYID, A.ENTITY_ID FROM BIOTAB1 A   inner join WEBREPORTS.dbo.TB912 TB912 on A.ENTITY_ID=TB912.ENTITYID --  inner join WEBREPORTS.dbo.TB967 TB967 on A.ENTITY_ID=TB967.ENTITYID WHERE 1=1   AND A.PRIMARY_RECORD_STATUS IN ('A','-')   AND EXISTS (     SELECT 1 FROM AFFIL X     WHERE X.ENTITY_ID = A.ENTITY_ID AND X.RECORD_TYPE IN ('TS')   )   AND   (     1=0 OR     (       1=1 and TB912.MAILCODE IN ('YAN') --    ) OR ( --      1=1 and TB967.EVENTCDE IN ('AF000055')     )   ) ------------------------------------------------------------ That's correct behavior.  If I run the select statement by itself, it returns 2 records. But if I uncomment the three lines that are commented out, the query only inserts ONE record. The SELECT statement run by itself (with the commented out lines uncommented) returns two records. Why won't it insert the two records? I'm just running this stuff in SQL Server Management Studio, but the results from Coldfusion are the same. Rick
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

October 24, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference