473,597 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can i insert data in to a table from another database

13 New Member
Hi,
Can any body tell that

suppose i have member table in database1

I want to insert data in to this table, getting data from another database table suppose database2 table

And is it possible ?
Thank you.
May 26 '07 #1
3 30066
Atli
5,058 Recognized Expert Expert
You can do somthing like this.

Expand|Select|Wrap|Line Numbers
  1.  
  2. INSERT INTO 
  3.   db1.myTbl(value)
  4. VALUES
  5.   ((
  6.     SELECT value
  7.     FROM db2.myTbl
  8.     LIMIT 1
  9.   ))
  10.  
May 26 '07 #2
prashanth023
13 New Member
thank you. it will work in normal situation. my requirement is.
i created to objects for two databased located in different servers like this

$obj1= new mysqli("192.168 .343.44", "user", "password", "db1");
$obj2=new mysqli("192.325 .236.23","user" ,"password","db 2");

now we hvae two objects with two databases.

How can i insert into another table from ditterent database.

Help me.

Thank you.
May 28 '07 #3
blossam
29 New Member
Hi,
Can any body tell that

suppose i have member table in database1

I want to insert data in to this table, getting data from another database table suppose database2 table

And is it possible ?
Thank you.

ya it is possible

u can run query like --->

if structure of the both tables are same then...
"insert into database1.membe r select * from database2.membe r"

if structure of both tables are not same then
"Insert into database1.membe r select columnname1,col umnname2 from database2.membe r"

replace columnname1,col umnname2 with required field name
May 31 '07 #4

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

Similar topics

2
2861
by: Santo Santis | last post by:
How can I make an .exe file that can insert data automatically in a SQLServer database, I can do it in C, but how can I connect to SQLServer and execute a query. All data that I have to insert are data that I can have from PC environment variables. Thanks
0
3982
by: Dinu | last post by:
Hi All I am trying to insert data within a transaction, into a Db2 database from asp.net. I have created a System DSN using ISeries Access Driver(32 bit) for Windows. I am then connecting to it using Microsoft .Net data provider from asp.net. I am able to insert data by using connection and comand object without
2
5553
by: Bruce Mogayzel via AccessMonster.com | last post by:
What is the syntax to lookup data in another database? Thanks Bruce -- Message posted via http://www.accessmonster.com
10
3432
by: coffeesin | last post by:
Hi, I have a Table containing these fields: id-no, cold, cold ever, cold date,flu,flu ever and flu date. (The properties of id-no, cold,cold ever,flu,flu ever are set as Numbers.) What i want to do is to select and export the data into another database that has satified the criteria using Access Module.Is it possible?I've tried using the following code but it doesnt seem to work accordin to what i want. Public Sub MakeTable_new() ...
1
1303
by: prasadmummidi | last post by:
do anyone say me how to "insert data into database" in c#.net(connection less). i already created the table in sql server and it has no data in it.
0
2190
by: danishce | last post by:
Hello, I want to insert data directly into my windows form data grid and load a combobox(userid) in the 1st column of data grid,a textbox(password) in 2nd column of datagrid. The code for insert data is: dim cmd as new oledbcommand("insert into table(userid,password) values('" & cmbcol1.text & "','" & txtcol2.text & "')",connection) dim da as new oledbdataadapter dim ds as new dataset da.selectcommand=cmd da.fill(ds) messagebox.show...
2
1050
by: gayano | last post by:
Hi all I'm Trying this code in vb 2005 express The database is sql 2005 express thease textbox are binded with a bindingsource it does not give me a error but it want insert the data to the database can anyone help me with this?? Private Sub InsertData() Dim Truckcode As Integer
8
6609
by: Betikci Boris | last post by:
Can not insert data into SQLite3 database through browser however i can easily insert data into my db from konsole, in both attmpts i used php 5.2.6 on 2.6.25.* linux kernel i think there is a problem with my php setup but i could not find it... here is the code; ---------------------------------------------------------------------------------------- $db = new PDO("sqlite:bar.db");
0
2724
by: akshalika | last post by:
I am new to Biztalk. In my project we need to connect oracle database and insert data into oracle table using BizTalk project. I use WCF Adapter pack(SP2). I create biztalk project then using Consume Adapter Service Add-in create schemas to insert data into oracle database and tow-way send port binding file Then create orchestration and logical receive port send port, Request-response port then after correctly connect those port with message...
17
17471
by: msmjsuarez | last post by:
Hello, I need help... How to automatically insert data to mysql database without submit button using php? Is there a way on this? thanks a lot.
0
8263
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8021
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6677
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5842
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3876
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3917
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2393
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.