copy column from one table to another table

Hi, I have 2 tables. 

Table1 has column1 and column2.
I wish to copy column1 into Table2 by using sql statement.
How do i do that?
Thank you.
2/25/2005 8:08:19 AM 16182 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 34

In general you'd do it like this:

Insert statement:

SELECT Column1 FROM Table1

Update statement:

Column1 = T1.Column1
Table2 T2
Table1 T1 ON T2.someID = T1.someID

Terri Morton
Engagement Manager, Neudesic

How to ask a question

2/25/2005 12:55:56 PM

Similar Artilces:

populating a column in one table with data in a column from another table?
Hi,I have one main table and multiple smaller tables, the main table consists of all the information gathered from the smaller tables, plus some other data. I've set primary keys for all the smaller tables and created a relationship where the primary key id matches an id field inside the main table eg. there's a smalltableid column in both the smaller table and the main table.some misc info:i'm using a dataset (should the key in the dataset be pointing to the main table, or the smaller one?)both relation and foreign key constraints are created (with no rules set)my problem is, the data from ...

insert multiple values from one table into one column from another table?
Hi, I'm attempting to create an insert statement that gets the values from multiple columns and insert them into one column from another table, is there a simple solution to do this?Here is something similar to what i'm wanting done, just it's not the correct way to do it, i want value1, value2 and value3 from one table to be combined and put into the value1 column of another table, what am i doing wrong? INSERT INTO tablename2 (value1 + value2 + value3)SELECT value1FROM tablename1 thanks in advance! INSERT INTO tablename2 (SELECT val1 + val2 + val3 FROM tabl...

try to copy data from one table into another table
PB8.0 , i built two tables, one is customer table,one is hosts table, they have some same columns,like customer name, company name ,etc. now, i built a datawindow of the customers, after i retrieve datas from the customer table to the datawindow , i hope i can copy datas of same columns from customer table to host table, so that i dont have to input same data again for the host table. what ways i can use and how to do? Use a Pipeline, at dawn datawindow. BMartins <jennifer> escreveu na mensagem > PB8.0 , i built two ta...

Copying html table rows from one table to another.
Hi Im am trying to copy table rows from one html table to another. Below is a one of my many attempts and all this does is moving the rows from the one table to the other. I would appreciate any help. int iCount; HtmlTableRow[] TableRows = new HtmlTableRow[Table1.Rows.Count]; Table1.Rows.CopyTo(trs,0); for (iCount = 0; iCount < TableRows.Length; iCount++) { Table2.Rows.Add(TableRows[iCount]); } Thanks ...

Copy Records From one table to another table with same structure
Hi allI have two tables in SqlServer with Exactly Same Structure,I want to Copy all Records fromone of them to another one.I came across to "" statement But i have two problem 1) I don't know any thing about Columns name!!! i just know they have same structure and as far as i know , "" need the Column list to operate correctly, am i right? 2) these two table have One Prinary Key column with IDENTITY feature. Any Help Greatly appriciated.Regards.Nothing Is Quite Impossible !!! Personally, i found DTS is the best way you just need to set&nbs...

Problem in retrieving data from two table when one column entry in each table are same but no column in these table match with each other
Hello there!,       First of all i have two tables . one acts as a master table and other one acts as a details table. Currently the ptoblem with my procedure is, i have entered two entries for one project in the Master table. and to briefly discribe those two entries in the master table , i have entered two entries in the Details table corresponding to the entries in the master table. Now i need to combine the master table entries and the details table entries for the same project which should give only two entreies. but my procedure gives four entries. Could yo...

can I compare one record from one table to another record in another table?
can I compare one record from one table to another record in another table? I need to test if this condition is met. My scenario is: i need to check one table for a value and compare it to a list of records. for example, table 1           columnrecord 1- applesrecord 2- orangesrecord 3- grapes table 2            col1   col2   col3    col4record 1- Null , Null, Null, grapes I need to compare table 2 records with a list of records from table 1. the fru...

Summing a Column in one Table and writing that vaule to another Table
Hello Everyone,   I have a column I want to sum and then write that value to the other table.  Here are the columns:   1st Table: pcsoems_master.docket_num & pcsoems_master.amt_paid 2nd Table: psoems_trans.tdocket & pcsoems_trans.amt_pd I am summing the pcsoems_trans.amt_pd and wanting to write the value to pcsoems_master.amt_pd column.  THey are linked by pcsoems_master.docket_num to pcsoems_trans.tdocket.  Any suggestions would be great.  I do want the column to keep adding when I add a amount to the paid part from pcsoems_trans.amt_pd.  I h...

Copying Columns from one Data Table into another
Does anyone have any code examples or can point me in the direction of a good tutorial or ten on this subject.  I have an existing database that I want to import data from at certain times.  I have both tables in my data set and they are in two different database files.  What are the best practices?  Also any advice on any 2.0 books, can't seem to find any reviews on any of them.   Cheers, BCRemember to mark any post that is helpful as an answer and change posts status to Resolved to help others in the future. cheers,BC Hi BC, ...

Data copy from one column to another in same table
Hi Everyone, I have a table defined as the following... CREATE TABLE dbo.TLETTERS_RTF_BASE ( LETTERS_RTF_NBR int NOT NULL, LETTER_TYPE_NBR int NOT NULL, LETTER_NAME varchar(100) NULL, UNIT_CD char(2) NULL, HEADER_TEXT image NULL, BODY_TEXT image NULL, FOOTER_TEXT image NULL, LETTER_DW_NAME varchar(75) NULL, FOREIGN KEY (LETTER_TYPE_NBR) REFERENCES dbo.TLETTER_TYPE (LETTER_TYPE_NBR) ) Certain rows have null values in the BODY_TEXT column. I want to take another valu...

How do i copy / insert a Primary Key value of one table into another table?
  Hi i have set up  two very simple tables, I want a user to be able to create a basic account ( data stored in User_Profile  table with Id set as the Primery Key as Identity) I want the user to be able to be able to return to their account at a later date and then post multiple reviews of different bands they have seen at a later date. I kept the tables in my example very simple so I could get my head around the concept, but generally, I want to connect the Id (PK) value in User_Profile table to the User_Id filed in the User_Review table, so every review th...

Copy values from one table to another table using LINQ to SQL?
Hello,I have two database tables that have different names but identical structure (columns).What is the easiest way to copy the values from one table to the other table using LINQ to SQL? Thanks,-- shawn shawn Hi, As far as I research, we could use "foreach"  to insert the data from one table to another table. The code is shown below.         //there exist two table list and listSecond        DataClassesDataContext dataClass = new DataClassesDataContext(); //create the instance of the DataCon...

How to move data from one table to another table w/o affecting the table definition?
Hello All! I have a production server and a development server. On the production server, I have a table (thin a database) that already contains data. On the development server, I created a table (still within another database) and I want that table of the development server to contain the data from the table of the production server. But, both tables don't have the same table definition, meaning in the table of the development server, I have added a new column named ID that I want to use as a primary key column, but I don't have tha...

Copying data from one table to other table
Hello All, I have two tables in DB2, BNKDBF and BNKPOS. Lets call there tables A and B respectively. Table A has 11 rows and 9 fields. And Table B has zero rows and 11 fields. One thing.. there will always be 11 rows in table A. Now i want to do is that copy those 11 rows from Table A to Table B and then put data in two additional fields in all rows of Table B. Faisal insert into tableB   select * from tableAYou'll need to give more information on the additional fields if you want help with them.Nick Nick, Please can ellaborate this thing a little bit...

Web resources about - copy column from one table to another table -

Damac Properties strips Donald Trump's name from Dubai golf complex over 'Muslim ban' comments
A billboard outside the Akoya by Damac complex had shown Trump in a red hat swinging a golf club against a backdrop of a lush green golf course ...

Tesla now using leftover upholstery leather from its cars to make stylish iPhone cases
Just barely in time for Christmas, Tesla updated its online store to add new apparel and accessories, including new iPhone 6 and 6 Plus leather ...

JJ Abrams Says ‘The Raid’ Stars Are “Incredible” In ‘Star Wars: The Force Awakens’
Three of the main actors from Gareth Evans ’ The Raid and The Raid 2 have roles in J.J. Abrams ‘ Star Wars: The Force Awakens . How did The Raid ...

Kurt Russell blasts gun control push: “I think it’s absolutely insane”
When reporters want to discuss firearm policies with Kurt Russell, they’d better bring a better game than the hapless Jeffrey Wells managed. ...

IEA Warns Energy Must Be At Core Of COP21 Climate Deal
The International Energy Agency has warned that energy must be at the core of any COP21 climate agreement, or else climate efforts are at risk. ...

U.S. officials search for missed red flags ahead of San Bernardino shootings
Washington Times U.S. officials search for missed red flags ahead of San Bernardino shootings Washington Times . FBI Searches Underwater ...

Tokyo’s drone squad will deploy 10-foot drones armed with nets to police the sky
(credit: Metro) In an effort to enforce no-fly-zones across the city, Tokyo's Metropolitan Police Department is launching a drone squad. According ...

Heartbroken Kristin Cavallari Takes Walk After Learning of Missing Brother ...
People Magazine Heartbroken Kristin Cavallari Takes Walk After Learning of Missing Brother ... People Magazine A somber Kristin Cavallari ...

Dow And DuPont Merging To Create Massive Chemical Voltron In $130B Deal
It may sound like the perfect marriage of the cold war era, but it’s 21st century business all over: Dow and DuPont, the two oldest, biggest ...

Season two of the gripping podcast Serial is now available
From the creators of The American Life and hosted by Sarah Koenig, the popular podcast Serial began last year. Telling a true story surrounding ...

Resources last updated: 12/11/2015 4:28:30 PM