HOW TO INSERT 10000 DATA AT A TIME IN SQLSERVER

aditya kumar Patel

Total Post:254

Points:1810
Posted by  aditya kumar Patel
 703  View(s)
Ratings:
Rate this:
I want to  insert 10000 Data at a time in SqlServer .please help me how to write query.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: How to insert 10000 Data at a time in Sqlserver

    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



Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!