Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 updating blank table from populated table

Author  Topic 

alecwh22
Starting Member

15 Posts

Posted - 2011-07-26 : 06:20:41
I have two dables one with 10 colomns (col1, col2, ect for ease) that we will call TABLE and one with more that 10 colomns that we will call table1. col1 is the primary key in both tables and I want to add new rows to TABLE consisting of the data in col1 to col10 in table1.

no matter how I do it I get 0 rows affected (which is less than succesful)

any help?

NOTE: there will in time be a table2 and table3 and so on whose col1 to col10 will need to be inserted into TABLE in the same manor as table1. the background is that table1 (and table2, table3 ect) is imported from excel spreadsheets (details of each stock intake given to us by supplier) and that is the only means by which I am alowed to recieve data

alecwh22
Starting Member

15 Posts

Posted - 2011-07-26 : 06:28:07
is now working, for some reason INSERT was not working for complete rows so inserted primary key and then use UPDATE statement FROM the two tables under an INNER JOIN on the primary key
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-26 : 12:15:08
might be you were trying to insert values directly to identity column which would have failed or may be its a pk violation that happened. Anyways glad that its working fine now

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -