Incorrect syntax near '('.

  • This has me puzzled. I have SQL 2005 SP3 on my laptop, and on a server.

    If I run this on my laptop, I get results:

    SELECT *

    FROM sys.dm_db_index_operational_stats (DB_ID(N'AdventureWorks'),OBJECT_ID(N'Production.WorkOrder'),1);

    (copied from BOL)

    If I run it on the server, I get an error.

    Msg 102, Level 15, State 1, Line 2

    Incorrect syntax near '('.

    I copy/paste so the code is exactly the same.

    Is there some server setting that's causing it ? I didn't see any relevant differences.

  • Hmmm, you are short a parameter (this function requires four parameters and you are passing in three parameters). Maybe that is causing the difference (but shouldn't work on any version of sql 2005 with insufficient parameters).

    Is the database, where it gives an error, in sql 2000 compatibility?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • YES, BOL has a typo, but it passes a syntax check on one server, but not the other.

    If I use my own DB and table, same problem. Results on one, but syntax error on the other

  • CirquedeSQLeil (5/21/2010)


    Hmmm, you are short a parameter (this function requires four parameters and you are passing in three parameters). Maybe that is causing the difference (but shouldn't work on any version of sql 2005 with insufficient parameters).

    Is the database, where it gives an error, in sql 2000 compatibility?

    BINGO ! .... Thanks :blush:

  • homebrew01 (5/21/2010)


    CirquedeSQLeil (5/21/2010)


    Hmmm, you are short a parameter (this function requires four parameters and you are passing in three parameters). Maybe that is causing the difference (but shouldn't work on any version of sql 2005 with insufficient parameters).

    Is the database, where it gives an error, in sql 2000 compatibility?

    BINGO ! .... Thanks :blush:

    You're welcome.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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