Multiple Line Insert Query Issue Looking for More Efficient WayBest way to get identity of inserted row?How to check if a column exists in a SQL Server table?Check if table exists in SQL ServerSQLite - UPSERT *not* INSERT or REPLACEInserting multiple rows in a single SQL query?What is the best way to auto-generate INSERT statements for a SQL Server table?Improve INSERT-per-second performance of SQLite?What are the options for storing hierarchical data in a relational database?Get size of all tables in databaseReset identity seed after deleting records in SQL Server
First sign that you should look for another job?
How to add arrows in smartdiagram (descriptive diagram)
Should I refuse to be named as co-author of a low quality paper?
Smart-expansion of a range to a list of numbers
Ability To Change Root User Password (Vulnerability?)
Does the Nuka-Cola bottler actually generate nuka cola?
Does a bank have to tell me if a check made out to me was cashed there?
Why am I getting a strange double quote (“) in Open Office instead of the ordinary one (")?
How creative should the DM let an artificer be in terms of what they can build?
What is the color of artificial intelligence?
Origin of "boor"
I have a problematic assistant manager, but I can't fire him
What would be the way to say "just saying" in German? (Not the literal translation)
If I leave the US through an airport, do I have to return through the same airport?
Does putting salt first make it easier for attacker to bruteforce the hash?
How can one's career as a reviewer be ended?
Separate SPI data
Is it safe to change the harddrive power feature so that it never turns off?
Electricity free spaceship
Fermat's statement about the ancients: How serious was he?
Why Does Mama Coco Look Old After Going to the Other World?
I've been given a project I can't complete, what should I do?
Getting UPS Power from One Room to Another
Are polynomials with the same roots identical?
Multiple Line Insert Query Issue Looking for More Efficient Way
Best way to get identity of inserted row?How to check if a column exists in a SQL Server table?Check if table exists in SQL ServerSQLite - UPSERT *not* INSERT or REPLACEInserting multiple rows in a single SQL query?What is the best way to auto-generate INSERT statements for a SQL Server table?Improve INSERT-per-second performance of SQLite?What are the options for storing hierarchical data in a relational database?Get size of all tables in databaseReset identity seed after deleting records in SQL Server
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have created a SQL Server database table and have many data entries to enter into the table. In this particular scenario I have two columns, Technology Questions and time_entered.
I have tried to combine the existing data values into a single INSERT INTO statement, however I have not been able to find a way to scale it up so I don't have spend all day copying over basic data.
This query works however note that it has only 4 data elements, two for each column. I'd like to scale this up so I can insert hundreds of lines at once. The insert statement below I derived from the existing data below (from a SQLITE3 table and I am trying to insert the data into a SQL Server database).
INSERT INTO questiontype([Technology Questions], time_entered)
VALUES ('Technology Question', '2018-10-29 13:31'),
('Technology Question', '2018-10-29 14:11')
The above example works great but I don't know the best way to scale this up.
Example of existing data (There are hundreds of rows like below)
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 13:24
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 16:23
Technology Question|2019-03-23 16:26
Technology Question|2019-03-23 16:59
Technology Question|2019-03-24 13:34
Technology Question|2019-03-24 15:11
Is there a more efficient way by chance?
sql
add a comment |
I have created a SQL Server database table and have many data entries to enter into the table. In this particular scenario I have two columns, Technology Questions and time_entered.
I have tried to combine the existing data values into a single INSERT INTO statement, however I have not been able to find a way to scale it up so I don't have spend all day copying over basic data.
This query works however note that it has only 4 data elements, two for each column. I'd like to scale this up so I can insert hundreds of lines at once. The insert statement below I derived from the existing data below (from a SQLITE3 table and I am trying to insert the data into a SQL Server database).
INSERT INTO questiontype([Technology Questions], time_entered)
VALUES ('Technology Question', '2018-10-29 13:31'),
('Technology Question', '2018-10-29 14:11')
The above example works great but I don't know the best way to scale this up.
Example of existing data (There are hundreds of rows like below)
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 13:24
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 16:23
Technology Question|2019-03-23 16:26
Technology Question|2019-03-23 16:59
Technology Question|2019-03-24 13:34
Technology Question|2019-03-24 15:11
Is there a more efficient way by chance?
sql
Look at the example of an insert usingSELECTrather thanVALUESdocs.microsoft.com/en-us/sql/t-sql/statements/…
– Dale Burrell
Mar 24 at 20:35
add a comment |
I have created a SQL Server database table and have many data entries to enter into the table. In this particular scenario I have two columns, Technology Questions and time_entered.
I have tried to combine the existing data values into a single INSERT INTO statement, however I have not been able to find a way to scale it up so I don't have spend all day copying over basic data.
This query works however note that it has only 4 data elements, two for each column. I'd like to scale this up so I can insert hundreds of lines at once. The insert statement below I derived from the existing data below (from a SQLITE3 table and I am trying to insert the data into a SQL Server database).
INSERT INTO questiontype([Technology Questions], time_entered)
VALUES ('Technology Question', '2018-10-29 13:31'),
('Technology Question', '2018-10-29 14:11')
The above example works great but I don't know the best way to scale this up.
Example of existing data (There are hundreds of rows like below)
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 13:24
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 16:23
Technology Question|2019-03-23 16:26
Technology Question|2019-03-23 16:59
Technology Question|2019-03-24 13:34
Technology Question|2019-03-24 15:11
Is there a more efficient way by chance?
sql
I have created a SQL Server database table and have many data entries to enter into the table. In this particular scenario I have two columns, Technology Questions and time_entered.
I have tried to combine the existing data values into a single INSERT INTO statement, however I have not been able to find a way to scale it up so I don't have spend all day copying over basic data.
This query works however note that it has only 4 data elements, two for each column. I'd like to scale this up so I can insert hundreds of lines at once. The insert statement below I derived from the existing data below (from a SQLITE3 table and I am trying to insert the data into a SQL Server database).
INSERT INTO questiontype([Technology Questions], time_entered)
VALUES ('Technology Question', '2018-10-29 13:31'),
('Technology Question', '2018-10-29 14:11')
The above example works great but I don't know the best way to scale this up.
Example of existing data (There are hundreds of rows like below)
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 10:40
Technology Question|2019-03-23 13:24
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 13:55
Technology Question|2019-03-23 16:23
Technology Question|2019-03-23 16:26
Technology Question|2019-03-23 16:59
Technology Question|2019-03-24 13:34
Technology Question|2019-03-24 15:11
Is there a more efficient way by chance?
sql
sql
edited Mar 24 at 21:16
Hadi
26.5k73175
26.5k73175
asked Mar 24 at 20:34
tengoindiamiketengoindiamike
305
305
Look at the example of an insert usingSELECTrather thanVALUESdocs.microsoft.com/en-us/sql/t-sql/statements/…
– Dale Burrell
Mar 24 at 20:35
add a comment |
Look at the example of an insert usingSELECTrather thanVALUESdocs.microsoft.com/en-us/sql/t-sql/statements/…
– Dale Burrell
Mar 24 at 20:35
Look at the example of an insert using
SELECT rather than VALUES docs.microsoft.com/en-us/sql/t-sql/statements/…– Dale Burrell
Mar 24 at 20:35
Look at the example of an insert using
SELECT rather than VALUES docs.microsoft.com/en-us/sql/t-sql/statements/…– Dale Burrell
Mar 24 at 20:35
add a comment |
1 Answer
1
active
oldest
votes
(1) Linked Server approach
Since you are reading data from SQLite3, you can create a linked server from SQL Server and use a simple insert statement to import data:
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM openquery(sqlite_linked_server, 'select * from sqlitetable')
Additional information
- Creating a SQL Server Linked Server to SQLite to Import Data
(2) SSIS approach
If you are familiar with SQL Server integration Services, it is an efficient way to transfer data from a data source to another, you can use it to transfer data from SQLite through ODBC into SQL Server.
- CONNECTING TO SQLITE THROUGH SSIS
(3) Using ad-hoc query approach
I haven't tried this approach before, i don't know if it is efficient or not.
You can connect to SQLite database through ODBC without adding a linked server, you can do this using an ad-hoc query using OPENROWSET
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM OPENROWSET('MSDASQL', 'DSN=<odbc DSN>',
'SELECT * FROM sqliteTable')
Additional information
- Import data from SQLite to Microsoft SQL Server
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328303%2fmultiple-line-insert-query-issue-looking-for-more-efficient-way%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
(1) Linked Server approach
Since you are reading data from SQLite3, you can create a linked server from SQL Server and use a simple insert statement to import data:
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM openquery(sqlite_linked_server, 'select * from sqlitetable')
Additional information
- Creating a SQL Server Linked Server to SQLite to Import Data
(2) SSIS approach
If you are familiar with SQL Server integration Services, it is an efficient way to transfer data from a data source to another, you can use it to transfer data from SQLite through ODBC into SQL Server.
- CONNECTING TO SQLITE THROUGH SSIS
(3) Using ad-hoc query approach
I haven't tried this approach before, i don't know if it is efficient or not.
You can connect to SQLite database through ODBC without adding a linked server, you can do this using an ad-hoc query using OPENROWSET
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM OPENROWSET('MSDASQL', 'DSN=<odbc DSN>',
'SELECT * FROM sqliteTable')
Additional information
- Import data from SQLite to Microsoft SQL Server
add a comment |
(1) Linked Server approach
Since you are reading data from SQLite3, you can create a linked server from SQL Server and use a simple insert statement to import data:
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM openquery(sqlite_linked_server, 'select * from sqlitetable')
Additional information
- Creating a SQL Server Linked Server to SQLite to Import Data
(2) SSIS approach
If you are familiar with SQL Server integration Services, it is an efficient way to transfer data from a data source to another, you can use it to transfer data from SQLite through ODBC into SQL Server.
- CONNECTING TO SQLITE THROUGH SSIS
(3) Using ad-hoc query approach
I haven't tried this approach before, i don't know if it is efficient or not.
You can connect to SQLite database through ODBC without adding a linked server, you can do this using an ad-hoc query using OPENROWSET
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM OPENROWSET('MSDASQL', 'DSN=<odbc DSN>',
'SELECT * FROM sqliteTable')
Additional information
- Import data from SQLite to Microsoft SQL Server
add a comment |
(1) Linked Server approach
Since you are reading data from SQLite3, you can create a linked server from SQL Server and use a simple insert statement to import data:
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM openquery(sqlite_linked_server, 'select * from sqlitetable')
Additional information
- Creating a SQL Server Linked Server to SQLite to Import Data
(2) SSIS approach
If you are familiar with SQL Server integration Services, it is an efficient way to transfer data from a data source to another, you can use it to transfer data from SQLite through ODBC into SQL Server.
- CONNECTING TO SQLITE THROUGH SSIS
(3) Using ad-hoc query approach
I haven't tried this approach before, i don't know if it is efficient or not.
You can connect to SQLite database through ODBC without adding a linked server, you can do this using an ad-hoc query using OPENROWSET
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM OPENROWSET('MSDASQL', 'DSN=<odbc DSN>',
'SELECT * FROM sqliteTable')
Additional information
- Import data from SQLite to Microsoft SQL Server
(1) Linked Server approach
Since you are reading data from SQLite3, you can create a linked server from SQL Server and use a simple insert statement to import data:
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM openquery(sqlite_linked_server, 'select * from sqlitetable')
Additional information
- Creating a SQL Server Linked Server to SQLite to Import Data
(2) SSIS approach
If you are familiar with SQL Server integration Services, it is an efficient way to transfer data from a data source to another, you can use it to transfer data from SQLite through ODBC into SQL Server.
- CONNECTING TO SQLITE THROUGH SSIS
(3) Using ad-hoc query approach
I haven't tried this approach before, i don't know if it is efficient or not.
You can connect to SQLite database through ODBC without adding a linked server, you can do this using an ad-hoc query using OPENROWSET
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
INSERT INTO questiontype([Technology Questions], time_entered)
SELECT [Technology Questions], time_entered
FROM OPENROWSET('MSDASQL', 'DSN=<odbc DSN>',
'SELECT * FROM sqliteTable')
Additional information
- Import data from SQLite to Microsoft SQL Server
edited Mar 24 at 21:09
answered Mar 24 at 20:52
HadiHadi
26.5k73175
26.5k73175
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328303%2fmultiple-line-insert-query-issue-looking-for-more-efficient-way%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Look at the example of an insert using
SELECTrather thanVALUESdocs.microsoft.com/en-us/sql/t-sql/statements/…– Dale Burrell
Mar 24 at 20:35