0

I am trying to create some test data for the project i am working on. At the moment I have about 64000 records in my table but I need more. My question is can i copy all these rows and insert them again ?

I have tried:

Select * INTO dbo.Calls from dbo.Calls 
4

2 回答 2

2

因为主键必须包含唯一值,不能包含 NULL 值。因此,如果您的表没有主键,请使用以下查询。

对于所有列使用:

INSERT INTO dbo.Calls SELECT * fROM  dbo.Calls

对于选定的列使用:

 INSERT INTO dbo.Calls (<column name list>) SELECT  <column name list> FROM dbo.Calls
于 2013-04-24T06:18:05.917 回答
1

使用这个查询,以防你没有primary key

insert into table_name
select * from table_name

如果你有primary key然后使用这个

insert into table_name (col2,col3)
select col2,col3 from table_name
于 2013-04-24T06:09:44.637 回答