Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a table that contains 10 Columns, now i need to insert 100 records in that table. Is there any other way to add records easily without writing insert statement 100 times.

Please tell me the solution.........
Posted
Comments
zenspace 10-Jul-13 2:57am    
try using bulk insert.

Hi,

you can write procedure for this purpose.

create proc dbo.insertdata        
(        
	@inputXml xml       
	    
)        
AS        
BEGIN 
select * into #temp
	from openxml(@InputXMLHandle,'/Data')        
	with        
	(        
		columnname datatype,        
		columnname datatype,
		columnname datatype,
		columnname datatype,
		columnname datatype,
	)   
	
	
	
	 insert into tablename 
	select * from #temp
	
	
	drop #temp

end


hope this will help you....
 
Share this answer
 
v2
Input your data in excel file. Have it copy then paste. Or you can upload it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900