Search code examples
sqlsql-server-2005database-table

how to copy top 1000 records from 7000 records in existing table to other new table


I have a table A which consists more than 7k records,Now i am creating a new table B .In my new table B I need to copy only 1000 records from table A which has more than 7000 records.

No condition applies, it may be any thousand records from 7000 .


Solution

  • In SQL Server

    SELECT top 1000 *
    INTO newTableName
    FROM oldTableName;
    

    In MySQL

    SELECT *
    INTO newTableName
    FROM oldTableName Limit 1000;