cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Bulk insert into database from CSV file

DK_9985660
3-Newcomer

Bulk insert into database from CSV file

Hi Team,

 

I want to insert  entire data from csv to Table using Bulk Insert, so that entire data from CSV goes to Table 

by connecting one time to database , please suggest is there any option in PTC Thingworx

 

Regards,

Datta

 

 

ACCEPTED SOLUTION

Accepted Solutions

@DK_9985660 ,

 

Are you trying to store this in a ThingWorx storage entity (Stream or Datatable) or are you trying to insert these directly into a database via a SQL command?

 

 

If you're storing into a Stream or DataTable, you can use the AddStreamEntries or AddDataTableEntries service to insert in one operation.  If you're attempting to add into a database table, you can programmatically create your sql insert statement like:

 

INSERT INTO myTable (uid, label, value) VALUES
(1, 'label1', 'value1'),
(2, 'label2', 'value2'),
(3, 'label3', 'value3'),
.
.
.

 

Either way, you can use the CSV parser tools to first parse the CSV file into an infotable and then use one of the options above.

 

Hope that helps!

--Nick

View solution in original post

2 REPLIES 2

@DK_9985660 ,

 

Are you trying to store this in a ThingWorx storage entity (Stream or Datatable) or are you trying to insert these directly into a database via a SQL command?

 

 

If you're storing into a Stream or DataTable, you can use the AddStreamEntries or AddDataTableEntries service to insert in one operation.  If you're attempting to add into a database table, you can programmatically create your sql insert statement like:

 

INSERT INTO myTable (uid, label, value) VALUES
(1, 'label1', 'value1'),
(2, 'label2', 'value2'),
(3, 'label3', 'value3'),
.
.
.

 

Either way, you can use the CSV parser tools to first parse the CSV file into an infotable and then use one of the options above.

 

Hope that helps!

--Nick

slangley
23-Emerald II
(To:DK_9985660)

Hi @DK_9985660

 

If you found the previous response helpful, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Announcements


Top Tags