Create 100000 record at a sort. Insert More Than Lakh record in a sort.

CREATE TABLE TEMPEMPLOYEE
(
ID BIGINT,
NAME NVARCHAR(MAX)
)

CREATE PROCEDURE INSERT_TEMPEMPLOYEE
(
@NO BIGINT
)
AS
BEGIN
DECLARE @COUNT BIGINT
SET @COUNT=1
WHILE (@COUNT < @NO)
BEGIN
INSERT INTO TEMPEMPLOYEE(ID,NAME) VALUES(@COUNT,'V'+CAST(@COUNT AS nvarchar))
SELECT @COUNT = @COUNT + 1
END
END

INSERT_TEMPEMPLOYEE 100000

select * FROM TEMPEMPLOYEE

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s