This example inserts all rows from the employee table from the pubs database into a new table called employees. The IDENTITY function is used to start identification numbers at 100 instead of 1 in the employees table.USE pubsIF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'employees') DROP TABLE employeesGOEXEC sp_dboption 'pubs', 'select into/bulkcopy', 'true' SELECT emp_id AS emp_num, fname AS first, minit AS middle, lname AS last, IDENTITY(smallint, 100, 1) AS job_num, job_lvl AS job_level, pub_id, hire_dateINTO employees FROM employeeGOUSE pubsEXEC sp_dboption 'pubs', 'select into/bulkcopy', 'false'
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货