Tracing down MOM alert "Incorrect syntax near the keyword 'AND'. "

  • I am new to SQL Server, and received this MOM alert from a SharePoint server talking to a SharePoint database:

    Alert: Unknown SQL Exceptions

    Last modified by: System

    Alert description: Event ID 5586 from Source Windows SharePoint Services 3 on agent computer has triggered this Alert Description : Unknown SQL Exception 156 occured. Additional error information from SQL Server is included below.

    Incorrect syntax near the keyword 'AND'.

    How would I go about tracking this down? Run SQL Profiler looking for "AND" statements, or something similar?

    Regards,

    Jeff

  • Do you have the instance where it occurred?

    If it's a syntax error, I doubt you'll see it in the trace events because it won't execute, it'll fail to get past the optimizer. Hmmm... I'm not sure.

    I don't know about your code, but searching my code would find quite a few instances of the phrase 'AND.'

    You might try, and I don't think it will work, but you can try, to search against the cache in sys.dm_exec_query_text.

    I'm just not sure. I've never tried to capture a syntax error before.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • Grant,

    Thanks for the response. I do have the instance where it executed. I might have the developers search their codebase.

    I'll try looking for the proverbial needle-in-a-haystack in the cache.

  • You could probably run profiler and select some of the "Error and Warnings" events and see what it turns up. I used this before in a similar situation.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply