There was an error parsing the query RRS feed

  • Question

  • Hi all,

    I got problem when execute the query:

    if not exists( SELECT * 
                     WHERE  TABLE_NAME = 'M_EDI_Party')
                     print '123';

    Then I got error :

      Message=There was an error parsing the query. [ Token line number = 1,Token line offset = 1,Token in error = if ]
      Source=SQL Server Compact ADO.NET Data Provider

    But this query works well in sql management studio.

    I want to know is the "if" schema doesn't work in sqlce? 


    Friday, June 16, 2017 3:56 AM


All replies

  • Hello William,

    If you mean with SSMS running the query against a SQL Server (not Compact Edition), then it will work, but SQL Server Compact Edition supports only a small subset of Transact-SQL commands, see Differences Between SQL Server Compact and SQL Server and SQL Reference (SQL Server Compact) ; PRINT is not supported.

    At all, what should the PRINT be good for? If you what to get a result for your application use a SELECT instead

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Friday, June 16, 2017 5:40 AM
  • Hello Olaf,

    I think I should find other way to determine the table exists or not. anyway, thanks for help.

    Friday, June 16, 2017 8:16 AM
  • Just run: SELECT *

    And check the result in code - SQL Compact does not support IF and PRINT

    Please mark as answer, if this was it. Visit my SQL Server Compact blog

    Thursday, June 22, 2017 7:09 AM