Home > DeveloperSection > Forums > How to insert 10000 Data at a time in Sqlserver
aditya kumar Patel

Total Post:242

Points:1722
Posted on    January-01-2016 1:25 PM

 Database SQL Server  SQL  SQL Server 2008  SQL Server 2012 
Ratings:


 1 Reply(s)
 305  View(s)
Rate this:
I want to  insert 10000 Data at a time in SqlServer .please help me how to write query.


aditya kumar Patel

Total Post:242

Points:1722
Posted on    January-01-2016 1:35 PM

Step -1
we create a table as a customer name
create table Customer
(
Cust_Id bigint primary key,
Cust_Name varchar(200),
Cust_ContactNo varchar(20)
)
Step-2
write query for insert statement using while loop

declare @Cust_id int; 
select @Cust_id = 1;
while @Cust_id >=1 and @Cust_id <= 10000
begin
    insert into Customer values(@Cust_id,'Suresh' + convert(varchar(5), @Cust_id), '89532494**')
    select @Cust_id = @Cust_id + 1
end
Step-3
Write select statement query to see result

select* from Customer
YOUR RESULT WILL BE 10000 ROWS DATA LIKE BELOW
OUT PUT




Don't want to miss updates? Please click the below button!

Follow MindStick