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.
| Author |
Topic |
|
rehcems
Starting Member
3 Posts |
Posted - 2009-10-12 : 04:07:54
|
| Hello i am new in sql programming, and i have a problem already :)My problem is this: I have two tables "table1" and "table2". In "table1" i have five columns (ProductId, Price, Manufacturer, Name and IsNewProduct) I've did an import from an .xls file into "table1" (This table is temporary and now is populated whit contents from .xls file).select * into "tabel1" FROM OPENROWSET('MSDASQL', 'Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\products.xls', 'SELECT * FROM [Sheet1$]')Now i want to insert this products from "table1" in "table2" but i don't want to overwrite duplicate products in both tables.Someone can help me with this ? Thank'sP.S: Please excuse my bad English |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-10-12 : 04:24:18
|
Are you using SQL Server 2000, 2005 or 2008? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
rehcems
Starting Member
3 Posts |
Posted - 2009-10-12 : 04:30:17
|
| SQL Server 2005 |
 |
|
|
rehcems
Starting Member
3 Posts |
Posted - 2009-10-13 : 04:16:37
|
| Please help ... i need your urgent reply |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-13 : 04:20:22
|
insert table2selectProductId,ProductName,...from table1where not exists (select * from from table2 where table2.ProductId = table1.ProductId) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|