Testing Data Consistency

This example shows you how to test for data consistency.

  1. Connect to the database using a connection name in Interactive SQL:
    CONNECT DATABASE iqdemo 
    AS sales
  2. Start a read/write transaction:
    INSERT INTO FinancialCodes
    (Code, Type, Description) 
    VALUES ('e6', 'expense', 'Services')
  3. Connect to the same database with a different connection name and run a query:
    CONNECT DATABASE iqdemo
    AS marketing;
    SELECT CustomerID, OrderDate 
    FROM SalesOrder
    Sybase IQ returns the requested information; this is a read-only transaction.
  4. Connect to the same database using a different connection name:
    CONNECT DATABASE iqdemo
    AS accounting
  5. Start a read/write transaction:
    INSERT INTO FinancialCodes
    (Code, Type, Description) 
    VALUES ('r3', 'revenue', 'Sales & Marketing')
    This command will fail and be rolled back.
  6. As user sales, commit your transaction.
  7. Retry your transaction as user accounting. You may now commit or roll back this transaction.

Set some savepoints to return to as you run two similar transactions. This time, you can put the second transaction on hold until the first one completes.