Suppose you got huge data in Excel and you need to query the data by creating a table for the same.
So , as a first step , create a table with columns of appropriate data type in the same order as they are in excel.
Example, we have an excel with ID and Name data.Hence, we are creating a table as below.
CREATE TABLE [dbo].[NameList](
[ID] [int] NOT NULL,
[Name] [varchar](500) NOT NULL
) ON [PRIMARY]
Open the Excel with Data.
Click on bottom triangle before first cell to select entire data.🔻
The data will get selected as below.
Now copy and got to the SQL SERVER MGMT Studio.Open Object Explorer, go to the respective table namely "NameList".Right click and choose "Edit Top 200 Rows" as below.
Click on the Side triangle with star symbol to select the 2 columns.Then you can use Ctrl+V or paste command to paste the copied excel data.
After pasting the data , you can find all excel data as below.