Insert multiple rows in single query

Insert multiple rows in single query

 

Introduction

 

        In this article I am explaining how insert multiple rows using single SQL query.

 

Create table.

 

CREATE TABLE dbo.Sample

        (

        Code VARCHAR (3) NULL,

        Name VARCHAR (25) NULL,

        Address VARCHAR (25) NULL,

        PH VARCHAR (10) NULL

        )

GO

 

Insert query.

 

 

INSERT INTO Sample

SELECT '001','Suresh','Theyyath','9912102057'

UNION ALL SELECT '002','Jaseer ','Paikarathody','9846512031'

UNION ALL SELECT '003','Dhanya','Calicut','4952420850'

UNION ALL SELECT '004','Sujin','Thomas','9573024228'

UNION ALL SELECT '005','Sainul Abid','Vengara','9847127171'