stored procedure to copy table 1 to table 2 appending the data to table 2.

Just wondering if there is an easy transact statement to copy table 1 to table 2, appending the data in table 2.with SQL2000, thanks.

Paul G
Software Engineer
1/26/2006 11:11:14 PM 29906 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 1

Appending the rows, or the columns?

Append rows:

Insert into table2
SELECT * FROM table1

Append columns:

SET t2.col1=t1.col1+t2.col1, t2.col2=t1.col2+t2.col2, etc
FROM Table2 t2
JOIN Table1 t1 ON (t1.yourkeyhere=t2.yourkeyhere)

Not sure how useful the second append is, and it'd be really odd to actually want to do that, but you can, if you ever really needed to ;p

1/26/2006 11:41:41 PM
ok thanks, just need to append the rows.  Looks like that will do it.
Paul G
Software Engineer
1/27/2006 3:46:02 PM

Similar Artilces:

Reverse Engineer created copies of table (table:1, table:2)... How do I merge them back into 1 table?
PowerDesigner 12.1 I just reverse-engineered about 20 tables from our database, and it took one of my key tables and created two copies ("TableName : 1" and "TableName : 2"). I'm sure the engine was trying to make the diagram easier for it to auto-layout, but I want all the FKs and such from one table). How do I merge them back into just one table? Thanks, Jason Jason Vogel wrote: > PowerDesigner 12.1 > > I just reverse-engineered about 20 tables from our database, and it took > one of my key tables and created two copies ("Tabl...

Inserting Data Into Two Tables (Getting ID from Table 1 and inserting into Table 2)
I am trying to insert data into two different tables. I will insert into Table 2 based on an id I get from the Select Statement from Table1.  Insert Table1(Title,Description,Link,Whatever)Values(@title,@description,@link,@Whatever)Select WhateverID from Table1 Where Description = @DescriptionInsert into Table2(CategoryID,WhateverID)Values(@CategoryID,@WhateverID)  This statement is not working. What should I do? Should I use a stored procedure?? I am writing in C#. Can someone please help!!  Insert Table1(Title,Description,Link,Whatever)Values(@title,@descri...

Sql Server
Hello all,  I came across a situation where i would like to get your input on which method would be best to use. I have an Album Table and a Song Table which have a relationship. Both tables share practically the same columns. So I figured, why not put everything in one table, have a "Type" Column which would tell us if it is song or albumt, and have a PARENTID that would contain the album id for the song row so we know which songs are part of an album.  These tables can reach up to a million + rows. Which method would be more efficient for querying? ...

How to copy a table from SQL Server 1 to SQL Server 2
I have 2 SQL Server. I need copy a table from SQL Server 1 to SQL Server 2.  Does someone know how to do it? Please help! In Enterprise Manager, right click on the table, go to "All Tasks", "Export Data", then follow the steps in the wizard....

Stored Procedure not inserting into linking table properly - two tables
Hi can anyone help me with the format of my stored procedure below. I have two tables (Publication and PublicationAuthors). PublicaitonAuthors is the linking table containing foreign keys PublicaitonID and AuthorID. Seeming as one Publication can have many authors associated with it, i need the stored procedure to create the a single row in the publication table and then recognise that multiple authors need to be inserted into the linking table for that single PublicationID. For this i have a listbox with multiple selection =true. At the moment with the storedprocedure below it is creati...

Updating table 1 from table 2 question
I’m a complete newbie so forgive this question. If i have 2 tables  Table 1 has the columns for NNAME, PHNUM, SSN, DOB, JOB, UPDATED however the Job description is emptyTable2 has the columns for SSN and JOB The question is, how I write an update statement that looks at the SSN in table2 matches it to SSN in table 1 and fills in the job description for that person in table1 and adds yes to the UPDATED field. I have somewhere in the neighborhood of 25,000 records to update.any help would be greatly appreciated.Thank YouAdam    &nb...

1 table = OK, 2 tables = XXXX
Ok, I have two tables, one with projects in, and one with a list of contacts (in an SQL Server). I used VS to automatically create the connections and adapters - and all I do is fill the dataset and bind it to a datagrid (or bind a datagrid to it - whichever way it is). My problem? When I bind just the projects table, or the contacts table, then everything works fine and the table is displayed. When I try a Join to try to create one table from the two, then the page crashes saying that there was a problem with the sa account. Anyone got any ideas? JagsIntelligence is a burden....

Appending SQL Server Table Data to DB400 Table
Can anyone assist me in figuring out how to take all the data from an SQL Server 2000 table, and append the rows to a DB400 table? I am at a loss here...Will

merge join 2 tables into 1 new table
Hi i want to populate a new column with 2 existing ones For example The old table looks like thisColumn1 Column2 hello1      hello2 hello3      hello4 hello5      hello6 The new table to look like thisNewColumnHello1Hello2Hello3Hello4Hello5Hello6 I want to merge the old two columns into one new column, the old columns need to go line by line in the new columshope this makes senceThanks Rick B  Try this:create table #Test (column1 varchar(10), column2 varchar(10));insert into #Test values ('hello1', '...

How to search in 2 tables by using SQL Stored Procedure??
Hello, Is it possible to search in two tables, let's say table # 1 in specific field e.g. (age). If that field is empty then retrieve the data from table #1, if not retrieve the data from table # 2. Is it possible to do it by using SQL Stored Procedure?? Thank you Yes you can. By using stored procedure's IF condition. IF(Exists(SelectStatement)) ... ELSE ...Imagination is more important than knowledge..[Albert Einstein]Regards,Chandu A.J.:Is it possible to do it by using SQL Stored Procedure?? Well, this can be done, but it would be better for us to give you a good a...

Help with stored procedure that reteives data with a JOIN on 2 tables
I have a stored procedure that retreives data from 2 tables by doing a join but the problem is that the 2nd table might not have any value that matches the join field, no join record but I still want to pull the data from the 1st table anyway.   like in this example here, say there were NO records matching in the Album table, no record matching the "tbh_Frames.AlbumID = tbh_Albums.AlbumID" but I still want to retreive all the data from the Frames table; how would I have to modify this stored procedure? Also there could be data matching and in this case I would want all the d...

From Table to Table
I am working in Delphi 4 and ran into a roadblock I am unfamiliar with. I am trying to search and find values in one table based off of matching values in another. For example a table of objects with fields like name, description, type, ect; and a table of object properties in which each object can be represented multiple times based on the settings on the page at the time. So if i search the object property table (and eventually loop through to repeat for all objects) to find all cases of visible objects when a certain criteria is met. It stops on the first object with "Yes" in th...

Stored procedure for insert data from one table to another table
Hi,      I am having 2 tables. One is main table and another is history table. Whenever I update the main table, I need to insert the all the main table data to History table, before updating the main table. Overall it is like storing the history of the table updation. How do i write a stored procedure for this? Anybody has done this before? Pls help me.   I think it's better to implement this logic in your application rather than from SQL side. Your application can accpect a sequence of parameters, and firstly insert them into the history; if ...

Tables?! Why Tables?!
Bit random...but why does everything have to be rendered as a table?  It's starting to get quite annoying.  Formview - does this need to be a table?  the Menu??  Wouldn't it make sense to allow the option to...say...not render a Menu as a table?  Am I the only one that thinks this or are there others? You can use CSS Adapters to create your own adapters to override how the controls render it self. In the next version of ASP.Net, you will probably have more flexibility to specify the surrounding elements of th...

Web resources about - stored procedure to copy table 1 to table 2 appending the data to table 2. -

Invasiveness of surgical procedures - Wikipedia, the free encyclopedia
There are three main categories which describe the invasiveness of surgical procedures . These are: non-invasive procedures , minimally invasive ...

Procedure is more a snap than a snip
A QUEENSLAND doctor is bidding to set an unusual world record by performing the highest number of vasectomies in one day, with the help of fellow ...

Rushed cosmetic procedures a 'recipe for disaster'
​When Chanelle O'Hare went searching online for a deal on potential cosmetic procedures, she could not have imagined that what she ended ...

Jetstar procedures under investigation after planes took off too heavy
Jetstar's procedures for calculating the weight of its aircraft are under review by the Australian Transport Safety Bureau after two of its planes ...

Old Lady Lawyer: Uncivil Procedure
What is some of the worst behavior you've witnesses by attorneys?

NFL Announces Changes to Officiating Procedures for Playoffs - Bleacher Report
The NFL formally approved changes to its postseason officiating procedures to allow referees the opportunity to consult Vice President of Officiating ...

We need to reform the culture of law enforcement, not just the procedures
We need to reform the culture of law enforcement, not just the procedures by digby I have a new piece up at Salon this morning about police ...

Will Paul Ryan Make His Mark As Speaker By Instituting Impeachment Procedures Against President Obama ...
Wisconsin Ayn Rand devotee Paul Ryan just started his new job as Speaker of the dysfunctional House Republicans. And he's already headed for ...

Catholic hospital allowed to deny sterilization procedure, judge says
Hospital in California argued that the procedure known as ​tubal ligation would violate its religious freedom

TSA Updates Screening Procedure, Will Mandate Some Passengers Use Full-Body Scanners
... Imaging Technologies, or AIT, in favor of full-body pat-downs by TSA agents. Under the new mandate, not everyone can opt for the pat-down procedure. ...

Resources last updated: 1/16/2016 1:10:54 PM