Creating new tables from query results: select into  Using select into with IDENTITY columns

Chapter 8: Creating Databases and Tables

Checking for errors

select into is a two-step operation. The first step creates the new table and the second step inserts the specified rows into the table.

Because select into operations are not logged, you cannot issue them within user-defined transactions, and you cannot roll them back.

If a select into statement fails after creating a new table, Adaptive Server does not automatically drop the table or deallocate its first data page. This means that any rows inserted on the first page before the error occurred remain on the page. Check the value of the @@error global variable after a select into statement to be sure that no error occurred.

If an error occurs from a select into operation, use drop table to remove the new table, then reissue the select into statement.





Copyright © 2005. Sybase Inc. All rights reserved. Using select into with IDENTITY columns

View this book as PDF