Search code examples
t-sqlsybasesap-ase

Sybase: How to string multiple T-SQL commands together


I want to execute the following commands in a single DataAdapter command:

SET ROWCOUNT 10; SELECT * FROM dbo.SYB_CO_COLOUR ;SET ROWCOUNT 0

but this isn't accepted by my Sybase DB, not even in the Interactive SQL tools that ships with the DB.

I have not changed the command_delimiter from the semi-colon default so I am surprised that I get the error

Incorrect Syntax near ';'

What am I missing?

Thanks


Solution

  • Remove semicolon and seperate them by space like:

    SET ROWCOUNT 10 SELECT * FROM dbo.SYB_CO_COLOUR SET ROWCOUNT 0
    

    It outputs 10 rows and resets rowcount back.