Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 sql server 2012。
是否有任何查询可以将一个表中一半的行数插入另一个表。行数不必正好是一半。
使用TOP xxx PERCENT,在您的情况下,“一半”表示“50%”:
TOP xxx PERCENT
insert into another_table(col1, col2, col3) select top 50 percent col1, col2, col3 from one_table