473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can i insert thousand records using single query?

1 New Member
i hv an 10 columns and next to that other columns in a DB Table. That 10 columns hv same default values & others are retriving from other table and are nearly 1000 records. How can i insert that 1000 records using single query or by other method in DB Table ?
i used the forloop for 1000 records but it degrades the performance. i want a better solution on this.
Help me, Pls.
May 11 '07 #1
3 3397
pradeep kaltari
102 Recognized Expert New Member
i hv an 10 columns and next to that other columns in a DB Table. That 10 columns hv same default values & others are retriving from other table and are nearly 1000 records. How can i insert that 1000 records using single query or by other method in DB Table ?
i used the forloop for 1000 records but it degrades the performance. i want a better solution on this.
Help me, Pls.
Hi Tushar,
I guess you are looking for something like this:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO table1(col1,col2,...)
  2. SELECT col1,col2,...
  3. FROM table2
If you are looking for something else then please let us know. Also, it would be better if you post you code so that it would give an idea as what you are looking for.

May 11 '07 #2
8,127 Recognized Expert Expert
Welcome to TSDN.

Hope u enjoy the forum.

Feel free to put your doubts/queries in the forum.

But first give a try from your side before posting in forum.

And if possible mention what/how u have tried to solve the problem .

Then it will be helpful for the Experts in the forum in understanding/solving your problem

Best of Luck..
May 11 '07 #3
8,127 Recognized Expert Expert
It is not at all clear from your query what u want.

IF the structure of both the tables are same AND u want to insert data of one table to another thable THEN

Expand|Select|Wrap|Line Numbers
  1. insert into table1(select * from table2);
But if your query is different please do post back.
May 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: a-ok | last post by:
Hi, My client has a product database od around 20000 items. And it is updated every few days when he gets a catalog from the supplier. It's supposed to work like this: if there already is a product in the database with that ID (primary key), just UPDATE the price, and if there is no product with that ID it should do an INSERT for that...
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table records are manipulated to control the permissions. Example: The Press...
by: Randell D. | last post by:
Folks, I have a table of addresses and a seperate table with contact names - All addresses tie to one or more names - I would like to keep track of the number of names 'belonging' to an address and have thus included a column in my address table called num_of_contacts. Everytime I add a new contact, I would like to increment the...
by: os2 | last post by:
hi i have an insertion problem with my rtu table datatype for date1 field is: datetime i try to insert local date to the database (mysql) source code struct tm *date;
by: lesperancer | last post by:
I've got an access97 reporting mdb that pulls data (77,000 rows) from a sql server table into a local table to run reports if the local table is part of the reporting MDB, the insert statement (16 fields) takes less than 30secs, but because of db-bloat, I moved the local table to a 2nd MDB and per postings, this 2nd MDB is copied into a...
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am using MS-Access 2000 database table for this app. Note that the datatype of all the fields mentioned above are Text. Apart from the above columns,...
by: newbie | last post by:
Dear folks, pardon me if this is a stupid question. For this table --------------------------------------- | id | foo | bar | -------------------------------------- I understand that we can insert a row to the table per call, like this sql_query = "INSERT INTO `table` (`foo`, `bar`) VALUES ('$string_1',
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table using a code loop and an INSERT INTO query. About 800,000 records of raw text. Later, I can then loop through and parse these 800,000 strings into...
by: uma9 | last post by:
hi, the code below is used to insert a single record....i want to know how to insert multiple records using a "for" loop...please help Set connect = CreateObject ("ADODB.Connection") connect.open "DSN=OPTUMETL;Driver= Oracle in OraHome92;Server=urnts1.uhc.com;UID=OPTUMETL;PWD=OPTUMETL" Reporter.ReportEvent 0, "Database connection",...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.