none
An expression of non-boolean type specified in a context where a condition is expected, near ';'.

    Question

  • So I have a query that is generated by another program I wrote.  Occasionally I'll get the error from the subject line, but not always.  Here's an example of one of the queries that bounces the error:

     
    SELECT DISTINCT 
    	MP.SecType AS SSSecType, 
    	MP.Symbol AS SSSymbol, 
    	MSM.FullName AS SSFullName, 
    	MPri.ShareValue AS SSShareValue, 
    	MPri.Price AS SSPrice, 
    	UPPER(MSM.StateID) AS SSStateID, 
    	MSM.AxysSecUserDef2ID AS SSRating, 
    	CONVERT(varchar(10), MBI.CDate, 101) AS SSCallDate, 
    	MBI.CPrice AS SSCallPrice, 
    	MBI.YTMonMarket AS SSYieldMat, 
    	MBI.YieldToWorst AS SSYieldWorst, 
    	MBI.DurationToWorst AS SSDurWorst, 
    	CONVERT(varchar(10), MSM.MatureDate, 101) AS SSMatDate 
    FROM 
    	MoxyPosition AS MP LEFT JOIN 
    	MoxySecMaster AS MSM ON MP.Symbol = MSM.Symbol AND MP.SecType = MSM.SecType LEFT JOIN 
    	MoxyPrice AS MPri ON MP.Symbol = MPri.Symbol AND MP.SecType = MPri.SecType LEFT JOIN 
    	MoxyBondInfo AS MBI ON MP.Symbol = MBI.Symbol AND MP.SecType = MBI.SecType 
    WHERE 
    	MSM.MatureDate <> '01/02/1900';
    

    It's worth noting that if I copy this exact code into MS SQL Server Management Studio it runs like a champ.  What's causing this?

    *** Edit *** - I just noticed that I only get the error if the WHERE clause includes an operator that includes the '<' character (eg '<>', '<', '<=').
    • Edited by RFrost Tuesday, February 02, 2010 9:55 PM New information added.
    Tuesday, February 02, 2010 9:47 PM

Answers


  • It wasn't my ActionScript!  It was the VB!  I added these statements to my functions in the .asmx file and all is well!

    WhereClause = WhereClause.replace("&lt;", "<")
    OrderByClause = OrderByClause.replace("&lt;", "<")

    Thanks again guys, couldn't have gotten this far without your help!
    • Marked as answer by RFrost Tuesday, February 09, 2010 4:59 PM
    Tuesday, February 09, 2010 4:59 PM

All replies

  • SELECT DISTINCT 
    	MP.SecType AS SSSecType, 
    	MP.Symbol AS SSSymbol, 
    	MSM.FullName AS SSFullName, 
    	MPri.ShareValue AS SSShareValue, 
    	MPri.Price AS SSPrice, 
    	UPPER(MSM.StateID) AS SSStateID, 
    	MSM.AxysSecUserDef2ID AS SSRating, 
    	CONVERT(varchar(10), MBI.CDate, 101) AS SSCallDate, 
    	MBI.CPrice AS SSCallPrice, 
    	MBI.YTMonMarket AS SSYieldMat, 
    	MBI.YieldToWorst AS SSYieldWorst, 
    	MBI.DurationToWorst AS SSDurWorst, 
    	CONVERT(varchar(10), MSM.MatureDate, 101) AS SSMatDate 
    FROM 
    	MoxyPosition AS MP LEFT JOIN 
    	MoxySecMaster AS MSM ON MP.Symbol = MSM.Symbol AND MP.SecType = MSM.SecType LEFT JOIN 
    	MoxyPrice AS MPri ON MP.Symbol = MPri.Symbol AND MP.SecType = MPri.SecType LEFT JOIN 
    	MoxyBondInfo AS MBI ON MP.Symbol = MBI.Symbol AND MP.SecType = MBI.SecType 
    WHERE 
    	MSM.MatureDate NOT IN ('19000102') AND IsDATE(MSM.MatureDate) = 1;
    
    Does the above work for you?


    Can you run the following query? Does it reutun any data if yes then you have problem with your dates.

    select * from
    MoxySecMaster AS MSM where isdate(MSM.MatureDate) = 0
    Tuesday, February 02, 2010 10:26 PM
  • When I run...

    SELECT 
    	* 
    FROM 
    	MoxySecMaster 
    WHERE 
    	ISDATE(MatureDate) = 0;

    ...it returns 0 rows.

    Making the change you suggested doesn't alter the query results when I run it in Management Studio and fixes the problem directly relating to the query I posted.

    But I'm still getting the error whenever the WHERE clause of my query uses an operator that includes the '<' character.  Why?
    Wednesday, February 03, 2010 1:47 PM
  • Jonny,  

    >>Occasionally I'll get the error from the subject line, but not always.

    it tells me that SQL you posted is fine but when you get the error

    >>An expression of non-boolean type specified in a context where a condition is expected, near ';'

    what SQL statement is being passed? When you receive this error from your code can you debug or run a profiler to find out the SQL statement that was being passed?




     
    Wednesday, February 03, 2010 2:17 PM
  • I'm writing an application in Flex 3 Developer Studio.  All of my SQL queries are passed to a VB file as a WebService, so they queries are all written in my .asmx file and I only pass the parts of the query that change (in this particular case, the WHERE and ORDER BY clauses).  I can trace() the string that I'm passing to the .asmx file, and that's what I've been doing to figure out that my error only occurs when the operator in the WHERE clause includes the '<' character.
    Wednesday, February 03, 2010 2:46 PM
  • Well, the '<' character can be used to delimit URLs in text mode.  At the Windows operating system command line, '<' is used to redirect a file as input.

    Could your environment be falling prey to one of those interpretations?

    RLF 
    Wednesday, February 03, 2010 4:21 PM
  • I don't think so.  I have other queries that include the '<' character that run fine.  The only difference between those queries and this one is that I'm passing the WHERE and ORDER BY clauses as strings to the function in my .asmx file that actually queries the server.  Maybe I should use the bitwise operator for the '<' char?  Anyone know that offhand?
    Wednesday, February 03, 2010 7:17 PM
  • You can use alternate syntax and/or characteristic functions to work around the problem with the <, but I have no idea (other than the one offered) why this character is a problem to you.  Your statement:
       
        WHERE MSM.MatureDate <> '01/02/1900';

    Characteristic functions are normally coded as CASE statements these days, but here is an alternative.  The absolute value of the sign of the date difference will be 1 if the dates are not the same and 0 if the dates are the same.  (If you use this, document it.)

        WHERE  ABS(SIGN(DATEDIFF (DAY,MSM.MatureDate,'01/02/1900'))) = 1

    Using a CASE statement and avoiding a < character.

       WHERE (CASE
                     WHEN MSM.MatureDate =  '01/02/1900' THEN 0
                     ELSE 1
                   END) = 1

    Of course, that assumes that your Date column is totally pure and is not a DATETIME column with any time other than 00:00:00.000.  If you have to deal with time, then:

     WHERE (CASE
              WHEN DATEADD(DAY,DATEDIFF(DAY,0,crdate),0) =  '10/14/2005' THEN 0
              ELSE 1
            END) = 1

    But working around a particular character is a pain in the neck, so I hope that you can find the root reason.

    RLF

    Wednesday, February 03, 2010 8:15 PM
  • Here's the full VB function that queries the server...

    <WebMethod()> _
    Public Function SecSearch(WhereClause As String, OrderByClause As String) As DataSet
        Dim cn As SqlConnection = New SqlConnection("server=***;database=***;uid=***;pwd=***")
        cn.Open()
        Dim adapter As SqlDataAdapter = New SqlDataAdapter("SELECT DISTINCT MP.SecType AS SSSecType, MP.Symbol AS SSSymbol, MSM.FullName AS SSFullName, MPri.ShareValue AS SSShareValue, MPri.Price AS SSPrice, UPPER(MSM.StateID) AS SSStateID, MSM.AxysSecUserDef2ID AS SSRating, CONVERT(varchar(10), MBI.CDate, 101) AS SSCallDate, MBI.CPrice AS SSCallPrice, MBI.YTMonMarket AS SSYieldMat, MBI.YieldToWorst AS SSYieldWorst, MBI.DurationToWorst AS SSDurWorst, CONVERT(varchar(10), MSM.MatureDate, 101) AS SSMatDate FROM MoxyPosition AS MP LEFT JOIN MoxySecMaster AS MSM ON MP.Symbol = MSM.Symbol AND MP.SecType = MSM.SecType LEFT JOIN MoxyPrice AS MPri ON MP.Symbol = MPri.Symbol AND MP.SecType = MPri.SecType LEFT JOIN MoxyBondInfo AS MBI ON MP.Symbol = MBI.Symbol AND MP.SecType = MBI.SecType " & WhereClause & OrderByClause & ";", cn)
        Dim QueryResults As DataSet= New DataSet("QueryResults")
        adapter.Fill(QueryResults, "SecGridRes")
        cn.Close()
        Return QueryResults
    End Function

    ...and here's two examples of the strings that get passed to SecSearch (this one fails)...

    WhereClause = "WHERE MBI.DurationToWorst < 1 AND MSM.MatureDate NOT IN ('19000102') AND ISDATE(MSM.MatureDate) = 1 ";
    OrderByClause = "ORDER BY MBI.DurationToWorst ASC";

    ...(this one succeeds)...

    WhereClause = "WHERE MBI.DurationToWorst > 1 AND MSM.MatureDate NOT IN ('19000102') AND ISDATE(MSM.MatureDate) = 1 ";
    OrderByClause = "ORDER BY MBI.DurationToWorst ASC";

    I still can't figure out why a '<' in the WHERE clause screws this up, but I've used MonsterDebugger to isolate my problem to the function I posted above.
    Friday, February 05, 2010 3:12 PM
  • Two things to investigate:

    1-The contents of the parameters WhereClause and OrderByClause.  Could you print these out or write them to a file, so that you can examine what got passed.

    If your WhereClause = "WHERE MBI.DurationToWorst" then the problem is before the string gets to your function.  That would pop the problem from this function to higher up the stack.

    2. If the WhereClause inside the function is fine, please try to preconcatenate the strings into a variable then call the New SqlDataAdapter with that variable. (Also print this variable out or write it to a file.)  E.g.

    Dim adapter As SqlDataAdapter = New SqlDataAdapter(wholecommandString, cn)

    Let's see what we see,
    RLF

    Friday, February 05, 2010 4:38 PM
  • 1-The contents of the parameters WhereClause and OrderByClause.  Could you print these out or write them to a file, so that you can examine what got passed.

    The WhereClause and OrderByClause groups that I included in my last post were copied from an external debugger which intercepted two trace() functions which passed the variables that held the strings you see.  What you read there is exactly what gets read by the VB function down to the extra space at the end of the WHERE clauses.

    2. If the WhereClause inside the function is fine, please try to preconcatenate the strings into a variable then call the New SqlDataAdapter with that variable. (Also print this variable out or write it to a file.) E.g. 

    Dim adapter As SqlDataAdapter = New SqlDataAdapter(wholecommandString, cn)

    The method that I'm using for this function is used in nearly every other function in my VB file.  Why would this one break if the rest work just fine?  I'm still going to try this though as the rest of the query is static and it shouldn't be too difficult to slap together.

    *** Edit *** - I just tried passing the entire query as one string and I get the exact same problem.
    • Edited by RFrost Friday, February 05, 2010 8:58 PM Updated info.
    Friday, February 05, 2010 5:08 PM
  • Did you try a characteristic function to work around this problem? 

    As I said earlier, that is an unsatisfactory solution, but it is possible to get your code to work by rethinking the syntax of your compare.

    RLF

    Saturday, February 06, 2010 2:19 AM
  • I haven't, but I have new information.  I got the following error...

        SOAPFault (Server): Server was unable to process request. ---> Incorrect syntax near ';'.
        Incorrect syntax near the keyword 'AS'. 

    ...from this query...

    SELECT 
    	* 
    FROM 
    	(SELECT DISTINCT 
    		Grp.GrpName AS SPGrpName, 
    		Port.PortID AS SPPortID, 
    		dbo.Get_DURTOWORST(Port.PortID) AS SPDurToWorst, 
    		dbo.Get_YIELDTOWORST(Port.PortID) AS SPYieldToWorst, 
    		dbo.Get_YIELDTOMAT(Port.PortID) AS SPYieldToMat, 
    		CASE Port.UserDef2 WHEN 'General Market' THEN 'GM' ELSE Port.UserDef2 END AS SPState, 
    		Port.InvObj AS SPInvObj, 
    		Totals.AllocTotalMV AS SPMV, 
    		Totals.AllocTotalCash - Port.CashBuffer - ((CashBufferPct/100) * AllocTotalMV) AS SPFinalCash, 
    		(Totals.AllocTotalCash - Port.CashBuffer - ((CashBufferPct/100) * AllocTotalMV))/(CASE Totals.AllocTotalMV WHEN 0 THEN 0.01 ELSE AllocTotalMV END) * 100 AS SPCashWeight, 
    		CASE ISNULL(Rest.PortID, 'no') WHEN 'no' THEN '' ELSE 'R' END AS SPRestricted, 
    		CASE ISNULL(Mao.PortID, 'no') WHEN 'no' THEN '' ELSE 'Yes' END AS SPMao, 
    		Edit.Quant AS SPQuantity, 
    		Edit.Par AS SPParSQL, 
    		Edit.Notes1 AS SPNotesOne, 
    		Edit.Pending AS SPPending, 
    		Edit.Notes2 AS SPNotesTwo, 
    		Edit.NewSwap AS SPNewSwapFlag, 
    		CASE WHEN ((Totals.AllocTotalMV * 0.03) < 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.03) / 5) * 5 END AS SPSB, 
    		CASE WHEN ((Totals.AllocTotalMV * 0.05) < 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.05) / 5) * 5 END AS SPLB, 
    		((iSVoT.inState * 100) + ISNULL(dbo.Get_AdditionalNonTaxStates(Port.PortID, Totals.AllocTotalMV), 0)) AS SPinStat 
    	FROM 
    		vMoxyPortTotalMVAndCash AS Totals LEFT JOIN 
    		MoxyPortfolio AS Port 
    			ON Totals.PortID = Port.PortID LEFT JOIN 
    		MoxyPortRestriction AS Rest 
    			ON Port.PortID = Rest.PortID LEFT JOIN 
    		MoxyPortGroupAssociation AS Grp 
    			ON Port.PortID = Grp.PortID LEFT JOIN 
    		MoxyEditableVariables AS Edit 
    			ON Port.PortID = Edit.PortID LEFT JOIN 
    		vInStateAlloc AS iSVoT 
    			ON Port.PortID = iSVoT.PortID LEFT JOIN 
    		(SELECT 
    			PortID 
    		FROM 
    			MoxyPortGroupAssociation 
    		WHERE 
    			GrpName = 'mao') AS Mao 
    			ON Port.PortID = Mao.PortID) AS a 
    WHERE 
    	SPGrpName = 'justin' AND 
    	SPFinalCash > 0 
    ORDER BY 
    	SPFinalCash ASC;


    This is the strangest set of problems I've ever had.  This breaks my previous belief that the character '<' was somehow responsible for the query not functioning.

    So I'm back at square one.  This has become a pride issue at this point.
    Monday, February 08, 2010 2:11 PM
  • OK, here is what we know:

    1 - Your query shown above parses correctly in SQL Server Management Studio, so the problem is not with statement as intended.

    2 - Your error messages indicate syntax errors.  Therefore, the code you think you are executing is not the same as the code actually being executed.  (But you knew that already.)

    Error messages:

    1. An expression of non-boolean type specified in a context where a condition is expected, near ';'
        Possible Cause: 
             WHERE SpGrpName ;

    2. Incorrect syntax near ';'.
        Possible Cause:
             WHERE SPGrpName = 'justin' AND ;

    3. Incorrect syntax near the keyword 'AS'.
        Possible Cause:
             ORDER BY SpFinalCash AS
        Possible Cause:
             SELECT   Grp.GrpName AS ,
                           Port.PortID AS SPPortID,

    Actually, this second possible cause of #3 would give you two errors:
         Incorrect syntax near ','.
         Incorrect syntax near the keyword 'AS'.

    Now, since I can see your code, I know that you are not writing these errors.  But something is inducing them.  I suspect string truncation could be the cause.  You should review the length of all of your string variable to make sure that nothing is being lost.

    Also, since your trace did not reveal any distortion of the query, I believe that you should run SQL Server Profiler and catch the actual statement as received by the SQL Server. (If you do not have the rights to do this, then get your DBA or Administrator to do it for you.)

    Once you can see what SQL Server sees, you will probably have the answer.  (I see that this latest was a SoapError, but I don't know if the Soap protocol adds any problems.)

    RLF

    Tuesday, February 09, 2010 2:59 PM
  • Ya intercepting what the server is receiving is definitely my next step, but now I have a new one for you.

    Error:

        SOAPFault (Server): Server was unable to process request. ---> Incorrect syntax near ';'.
        Incorrect syntax near the keyword 'AS'. 

    Query:

    SELECT 
    	* 
    FROM 
    	(SELECT DISTINCT 
    		Grp.GrpName AS SPGrpName, 
    		Port.PortID AS SPPortID, 
    		dbo.Get_DURTOWORST(Port.PortID) AS SPDurToWorst, 
    		dbo.Get_YIELDTOWORST(Port.PortID) AS SPYieldToWorst, 
    		dbo.Get_YIELDTOMAT(Port.PortID) AS SPYieldToMat, 
    		CASE Port.UserDef2 WHEN 'General Market' THEN 'GM' ELSE Port.UserDef2 END AS SPState, 
    		Port.InvObj AS SPInvObj, 
    		Totals.AllocTotalMV AS SPMV, 
    		Totals.AllocTotalCash - Port.CashBuffer - ((CashBufferPct/100) * AllocTotalMV) AS SPFinalCash, 
    		(Totals.AllocTotalCash - Port.CashBuffer - ((CashBufferPct/100) * AllocTotalMV))/(CASE Totals.AllocTotalMV WHEN 0 THEN 0.01 ELSE AllocTotalMV END) * 100 AS SPCashWeight, 
    		CASE ISNULL(Rest.PortID, 'no') WHEN 'no' THEN '' ELSE 'R' END AS SPRestricted, 
    		CASE ISNULL(Mao.PortID, 'no') WHEN 'no' THEN '' ELSE 'Yes' END AS SPMao, 
    		Edit.Quant AS SPQuantity, 
    		Edit.Par AS SPParSQL, 
    		Edit.Notes1 AS SPNotesOne, 
    		Edit.Pending AS SPPending, 
    		Edit.Notes2 AS SPNotesTwo, 
    		Edit.NewSwap AS SPNewSwapFlag, 
    		CASE WHEN ((Totals.AllocTotalMV * 0.03) < 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.03) / 5) * 5 END AS SPSB, 
    		CASE WHEN ((Totals.AllocTotalMV * 0.05) < 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.05) / 5) * 5 END AS SPLB, 
    		((iSVoT.inState * 100) + ISNULL(dbo.Get_AdditionalNonTaxStates(Port.PortID, Totals.AllocTotalMV), 0)) AS SPinStat 
    	FROM 
    		vMoxyPortTotalMVAndCash AS Totals LEFT JOIN 
    		MoxyPortfolio AS Port ON Totals.PortID = Port.PortID LEFT JOIN 
    		MoxyPortRestriction AS Rest ON Port.PortID = Rest.PortID LEFT JOIN 
    		MoxyPortGroupAssociation AS Grp ON Port.PortID = Grp.PortID LEFT JOIN 
    		MoxyEditableVariables AS Edit ON Port.PortID = Edit.PortID LEFT JOIN 
    		vInStateAlloc AS iSVoT ON Port.PortID = iSVoT.PortID LEFT JOIN 
    		(SELECT 
    			PortID 
    		FROM 
    			MoxyPortGroupAssociation 
    		WHERE 
    			GrpName = 'mao') AS Mao ON Port.PortID = Mao.PortID) AS a 
    WHERE 
    	SPGrpName = 'open' 

    Not a ';' in sight in that query, so where is the error message supposed to point me?  Could it have something to do with the fact that I'm coding an AIR project in Flex Builder 3?
    Tuesday, February 09, 2010 3:22 PM
  • Tracing what the server was receiving in Profiler yielded results!

    The lines:

      CASE WHEN ((Totals.AllocTotalMV * 0.03) < 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.03) / 5) * 5 END AS SPSB, 
    CASE WHEN ((Totals.AllocTotalMV * 0.05) < 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.05) / 5) * 5 END AS SPLB, 

    get interpreted by the server as:

    CASE WHEN ((Totals.AllocTotalMV * 0.03) &lt; 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.03) / 5) * 5 END AS SPSB, 
    CASE WHEN ((Totals.AllocTotalMV * 0.05) &lt; 25000) THEN 25 ELSE FLOOR((Totals.AllocTotalMV / 1000 * 0.05) / 5) * 5 END AS SPLB, 


    ...Well there's yer problem...

    And this makes more sense because right now I'm passing the entire string to the .asmx file, so every time I do it sends the '<' in these two lines as '%lt;' and it bounces an error.  Before when I was just passing the WHERE and ORDER BY clauses it only bounced an error when the WHERE clause included a '<'.

    This looks to me like the Flex Builder compiler is to blame; damn you Adobe!

    So now the only questions remaining are "Why the ____?" and "How do I fix it?"
    Tuesday, February 09, 2010 3:29 PM
  • So, basically your code is being treated as XML, thus the conversion of those characters into the XML replacement codes.   (I only thought of that possibility once I saw the SOAP error, but I did not know enough to give a suggestion beyond "use Profiler".)

    Flex Builder is outside my knowledge, but is it able to produce a non-XML stream?  If so, it might be some setting that you can control.

    FWIW,
    RLF
    Tuesday, February 09, 2010 3:47 PM
  • I've moved the discussion over to actionscript.org's forums since those folks will know more about the Flex Builder compiler and environment.  If you want to follow this issue through to it's resolution here's a link to the thread I created: http://www.actionscript.org/forums/showthread.php3?p=969324#post969324.

    Thanks a ton for all your help, Russell (and Chirag).  I was pulling my hair out over this!
    • Marked as answer by RFrost Tuesday, February 09, 2010 4:08 PM
    • Unmarked as answer by RFrost Tuesday, February 09, 2010 4:57 PM
    Tuesday, February 09, 2010 4:07 PM

  • It wasn't my ActionScript!  It was the VB!  I added these statements to my functions in the .asmx file and all is well!

    WhereClause = WhereClause.replace("&lt;", "<")
    OrderByClause = OrderByClause.replace("&lt;", "<")

    Thanks again guys, couldn't have gotten this far without your help!
    • Marked as answer by RFrost Tuesday, February 09, 2010 4:59 PM
    Tuesday, February 09, 2010 4:59 PM
  • Hi,

    I found a cript and i want to run it.. But it doest even pass the parse... there are errors at both: "AND l.lineage_id )". eRROR is :

    An expression of non-boolean type specified in a context where a condition is expected, near ')'.

    How can i fix it ? Its just simple I guess but i cant read the code :(

    thanks

    =================================here is the code from gdbgeek.wordpress.com/category/spatial-view/ ================

    SELECT a.OBJECTID + 0 ObjectID,a.GlobalID,a.PlaceID,a.SHAPE,a.SDE_STATE_ID
    FROM dataowner.a82 a
    LEFT HASH JOIN
    (
    SELECT SDE_DELETES_ROW_ID,SDE_STATE_ID
    FROM dataowner.d82
    WHERE DELETED_AT IN
    (
    SELECT l.lineage_id
    FROM sde.SDE_states s INNER LOOP JOIN sde.SDE_state_lineages l ON l.lineage_name = s.lineage_name
    WHERE s.state_id in
    (
    select state_id from sde.SDE_versions where state_id <> sde.SDE_get_view_state()
    )
    AND l.lineage_id )
    ) d ON (a.OBJECTID = d.SDE_DELETES_ROW_ID) AND (a.SDE_STATE_ID = d.SDE_STATE_ID)
    WHERE a.SDE_STATE_ID IN
    (
    SELECT l.lineage_id
    FROM sde.SDE_states s INNER LOOP JOIN sde.SDE_state_lineages l ON l.lineage_name = s.lineage_name
    WHERE s.state_id in
    (
    select state_id from sde.SDE_versions where state_id <> sde.SDE_get_view_state()
    )
    AND l.lineage_id )
    AND d.SDE_STATE_ID IS NULL
    and NOT EXISTS
    (select SDE_STATE_ID from dataowner.MV_PLACE mv where mv.SDE_STATE_ID = a.SDE_STATE_ID)

    Tuesday, November 20, 2012 10:02 AM
  • This should really be a new thread, not attached to an old discussion.

    Quick response: AND l.lineage_id is incomplete.   You need something like:

    AND l.lineage_id < 0

    AND l.lineage_id IS NOT NULL

    These finish the statement.  The 'non-boolean' means that there is no comparison to test against.

    RLF


    • Edited by SQLWorkMVP Tuesday, November 20, 2012 1:38 PM
    Tuesday, November 20, 2012 1:38 PM