How to Bulk Insert to a SQL table from Lotusscript Agent - sql

I need upload over 10,000 records into a sql table from a lotusscript agent. Is there a way I can bulk load them? Excel file attachment is an option if I can do it that way. But I have to use lotusscript agent.

Refer to the answers to this question: Insert multiple rows WITHOUT repeating the "INSERT INTO ..." part of the statement?
First figure out what the correct syntax for providing values to a multiple record INSERT is in the particular SQL dialect that you are working with, and then write your LotusScript code to read your data values (from Excel, or from whatever the actual source is) and produce insert them into the right places in a string containing your SQL INSERT syntax. Then submit that SQL string to your database server.

Related

How to execute long running SQL statements in SQL Server with node

I got a big file contains with 10000 lines table rows data, and I had to insert it with a SQL method in my project, so I generated a very long SQL after parsing it. But it doesn't allow me to execute this at one time.
I think it should be placed in a transaction, and I got the way to use transaction with one short SQL in this doc. What method should I use in its document?
Hope you could process at SQL Server side using Bulk insert or OLEDB

In how many ways we can insert records in sql server

Like inserting single or multiple records at a time, one table data is inserting into another table with limited columns.
There are (at least) four ways:
INSERT. Pretty obvious. It supports both single rows and multiple rows supplied as literal values, as well as inserting the result of a query or stored procedure.
SELECT .. INTO inserts the results of a query into a new table.
BULK INSERT. Bulk inserts data from files. It's a little quirky and not very flexible when it comes to parsing files, but if you can get the data to line up it works well enough. Selecting data for bulk insert purposes can also be done with OPENROWSET(BULK, ...).
INSERT BULK. This is an internal command that's used under the covers by drivers that use the bulk insert protocol in TDS (the protocol used by SQL Server). You do not issue these commands yourself. Unlike BULK INSERT, this is for client-side initiated bulk inserting, for example through the SqlBulkCopy class in .NET, or SQL Server's own bcp tool.
All other interfaces and approaches to inserting data use one of these methods under the covers. Most of these will use plain old INSERT.
Bulk Insert
https://learn.microsoft.com/en-us/sql/t-sql/statements/bulk-insert-transact-sql
Insert Transact
https://learn.microsoft.com/en-us/sql/t-sql/statements/insert-transact-sql
Select Insert
https://www.w3schools.com/sql/sql_insert_into_select.asp
Hope this will help

Best practice for data migration

Currently We have developed a system for a manual work they have been doing using many excel files.
Is there a best practice for data migration? because I wanted to use backend language like .net to do the validation and insert into tables rather than using SQL to do migration.
Total record in excel is around 12K rows but for many tables so its not needed consider a lot about performance and it is only one time.
I would add a few calculated columns in Excel that would generate SQL Insert / Update scripts. Something like ="INSERT INTO table (column) VALUES ('"&A1&"');"
Then just copy calculated column and run it through SQL client. I used to have a macros to run it directly from Excel through OLEDB that would highlight failed expressions and store SQL Exceptions next to them.
That way the data can be easily tidied, corrected and SQL re-run as needed.

Export Excel table to sql using VBA

Can anyone point me to an example for exporting an excel table into an sql table, assuming the same structure, using VBA? I'm using Excel 2007. I've seen examples that read the data one row at a time and either run one insert per row, or build their recordset, and do UpdateBatch. Is there a way where I can select all record from the source table in excel and insert them all into the target sql table?
Bulk Insert is what you are looking for.
Try these:
Stackoverflow question
Bulk Insert - social msdn
Other way is to import in sql management studio
Import Excel spreadsheet columns into SQL Server database

Bulk INSERT into SQL Server CE

I am using WebMatrix for a site right now, and its built-in SQL Server Compact database, and it's alright, but it only lets you create one row at a time. It has no bulk insert features (as I expected). But, see I have tens of thousands of rows in a spreadsheet.
I used to use Navicat for SQL Server which let me define a table name, then it would automatically IMPORT the spreadsheet into a table! Tens of thousands of rows, All within about 30seconds. How can I get Navicat for SQL Server to connect to WebMatrix's database for my website so I can do mass-bulk-inserts?
I have a Bulk Insert library, that you may be able to use: http://sqlcebulkcopy.codeplex.com