- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
22-12-20 06:57 AM
Hi All,
Is there a way to do a bulk insert into MySQL table.
Thanks
------------------------------
Jongjong Oclarit
------------------------------
Answered! Go to Answer.
Helpful Answers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-12-20 07:05 PM
FWIW - There is a MySQL VBO available on the DX.
https://digitalexchange.blueprism.com/dx/entry/9648/solution/blue-prism---mysql-utility
Cheers,
------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
22-12-20 01:58 PM
Hi jongjong
Execute the sql statement and insert rows from a file.
"BULK INSERT
FROM '"&[path filename]&"' WITH (fieldterminator = ' ', rowterminator = '\n')"------------------------------
Kristian Holm
RPA programmer
PenSam (Pension Company)
Copenhagen Denmark
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
22-12-20 02:14 PM
Hello!
I think the best way is to use MySqlBlukLoader. Here is a link of the documentation https://dev.mysql.com/doc/connector-net/en/connector-net-programming-bulk-loader.html
Basically, this piece of code:
string connStr = "server=localhost;user=root;database=test;port=3306;password=******";
MySqlConnection conn = new MySqlConnection(connStr);
MySqlBulkLoader bl = new MySqlBulkLoader(conn);
bl.Local = true;
bl.TableName = "Career";
bl.FieldTerminator = "\t";
bl.LineTerminator = "\n";
bl.FileName = "c:/career_data.txt";
conn.Open();
bl.Load();
I hope I helped you
------------------------------
Pablo Sarabia
Programmer
Altamira AM
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-12-20 03:59 AM
Hi Guys,
Thanks for the reply I will try your suggestion once i will get the data from a file.
For now i will use this line of code below as data needs to be validated first.
INSERT INTO projects(name, start_date, end_date)
VALUES ('AI for Marketing','2019-08-01','2019-12-31'), ('ML for Sales','2019-05-15','2019-11-20');
Thanks
------------------------------
Jongjong Oclarit
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-12-20 07:05 PM
FWIW - There is a MySQL VBO available on the DX.
https://digitalexchange.blueprism.com/dx/entry/9648/solution/blue-prism---mysql-utility
Cheers,
------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-12-20 09:12 AM
Hi,
This approach will work only if SQL server has access to the file location, in many cases the Bot will get the Bulk Data from somewhere and need to insert it into DB, storing it into the file system may not be an option. also looping records one by one will take ages.
What could be an option here?
------------------------------
Bassam Yousif
Director
DAR-ME
Amman
------------------------------
