Tuesday, September 7, 2010

Brief about Select….into statement with an example in Sqlserver 2005

Select into is used to create back up copies of tables. It selects data from one table and inserts into another.

Syntax:
Select * INTO dest_table_name FROM source_table_name

Example: Select data from customer table into customer_backup
Select * INTO customer_backup FROM customer

It can also be used with WHERE clause for a condition.

Select * INTO customer_backup FROM customer WHERE cust_salary > 1000;

No comments:

Post a Comment