Set Showplan_xml Problem

  • Hi,

    I'm executing following query from C# code.

    Set Showplan_xml on\rGo\r--Query--\rGo\rSet Showplan_xml off\rGo

    So that it will be executed as

    Set Showplan_xml on

    Go

    --Query--

    Go

    Set Showplan_xml off

    Go

    But I'm getting error that

    Incorrect Syntax near 'Go'

    The SET SHOWPLAN statements must be the only statements in the batch.

    If i execute the same query in sql server it is working fine.

  • What's in the query? Can you post it?

  • Go is not a T-SQL command, it's syntax used in Management Studio to signal the end of a batch. If you're submitting it from a .Net application, you have to submit the batches separately yourself.

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

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