Using select into with IDENTITY columns  Selecting the IDENTITY column more than once

Chapter 8: Creating Databases and Tables

Selecting an IDENTITY column into a new table

To select an existing IDENTITY column into a new table, include the column name (or the syb_identity keyword) in the select statement’s column_list:

select column_list 
     into table_name
     from table_name

The following example creates a new table, stores_cal_pay30, based on columns from the stores_cal table:

select record_id, stor_id, stor_name
into stores_cal_pay30
from stores_cal
where payterms = "Net 30"

The new column inherits the IDENTITY property, unless any of the following conditions is true:





Copyright © 2005. Sybase Inc. All rights reserved. Selecting the IDENTITY column more than once

View this book as PDF