View Single Post

   
  #3 (permalink)  
Old 02-29-2008, 07:49 AM
jimserac@yahoo.com
 
Posts: n/a
Default Re: SQL UPDATE Database from Excel Table

John Bell wrote:
> Hi


> UPDATE C1R0
> SET col1 = ( SELECT col1 FROM [C1R0$] IN 'Excel
> 8.0;database=c:\excel\UpdateFinal1.xls'; WHERE [C1R0$].PK = C1R0.PK ),
> col2 = ( SELECT col2 FROM [C1R0$] IN 'Excel
> 8.0;database=c:\excel\UpdateFinal1.xls'; WHERE [C1R0$].PK = C1R0.PK ),


Many thanks, I will give this a shot.

I think that the place for referencing the location of the
Excel spreadsheet is provided for by an extension
to SQL (Transact-SQL?) but I have not done a whole
heck of alot of SQLing to be sure of all the details
and am learning it now.

I was hoping, given the elegant simplicity of the SQL
table copy code, that there might be an equally elegant
UPDATE SQL, particularly since I wanted to update the entire
table.

Will post if I find it.

Thanks again
Jim






> <jimserac@yahoo.com> wrote in message
> news:1117817010.651125.209050@f14g2000cwb.googlegr oups.com...
> >I had previously posted this in an Access forum
> > with negative results so will try here.
> >
> > Although this question specifies an Access database,
> > I also wish to accomplish this with a large MS SQL Server
> > database that we have.
> >
> > Question follows:
> >
> > The following SQL statement, used in VBScript,
> > will COPY a table from Excel to an Access mdb.
> >
> > SQL = "SELECT * INTO C1R0" & _
> > " FROM [C1R0$] IN ''" & _
> > " 'Excel 8.0;database=c:\excel\UpdateFinal1.xls';"
> >
> > What is the SQL statement that will
> > UPDATE an already existing Access table
> > with all rows from Excel spreadsheet?
> >
> > The columns of both Spreadsheet and database are the
> > same.
> >
> > Thanks
> > Jim
> >


Reply With Quote