Dec-12-2017, 08:09 PM
I am using SQL Server 2017 to save people's information, I created a simple data table [People] in [mydb] database CREATE TABLE [dbo].[People] ( [ID] [int] NOT NULL, [Name] [nvarchar](40) NOT NULL, [Age] [int] NOT NULL, [Height] [int] NOT NULL, [Weight] [int] NOT NULL CONSTRAINT PK_People PRIMARY KEY(ID)) GO person1 = Person(Name='Bob', Age=55, Height=165, Weight=70) person2 = Person(Name='Doe', Age=45, Height=185, Weight=90) person3 = Person(Name='John', Age=50, Height=175, Weight=85) people = [person1, person2, person3]I will have around 30,000 records of people like the above.
I want to use pyodbc or whatever software package to insert all the people records into [People] data table.
I also have a primary key [ID], I want to use the order in the list of people to be the primary key, for the above example, the ID could be: 1, 2, 3, etc...
I can't figure out how to do the bulk insert into SQL Server 2017 database, I think since SQL Server 2017 has native support for python, so this could be possible.
Please advise!
Thanks,