UPDATE STATISTICS failed with table name containing score symbol '-'.

  • Hello,

    Just for the fun !

    I have an old database (will be probably deleted next month). She contains a table with a non conventional name : dbo.db_log_pt-BR....!!!

    With an [EXEC sp_updatestats] on database, all tables are updated. But if I run a [UPDATE STATISTICS dbo.db_log_pt-BR], I'd the message below :

    Msg 170, Niveau 15, État 1, Ligne 2

    Line 2: Incorrect syntax near '-'.

    It's boring because one of my Administration SP use [UPDATE STATISTICS] and I haven't seen this error before :blink:

    So my question is how to update this table with using [UPDATE STATISTICS] 🙂 ?

    Philippe (Bigouden DBA)

  • UPDATE STATISTICS dbo.[db_log_pt-BR]

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Just simply and it's work fine.

    Thank you very much Gail.

    I must to improve my T-SQL practise 😉

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

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