Unix Technical Forum

Update remote table from local table

This is a discussion on Update remote table from local table within the SQL Server forums, part of the Microsoft SQL Server category; --> Greetings - I'm using an Access front end to a SQL Server (2000) databas*e. Via several steps, I create ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 06:52 AM
chris.ciotti@gmail.com
 
Posts: n/a
Default Update remote table from local table

Greetings -


I'm using an Access front end to a SQL Server (2000) databas*e. Via
several steps, I create a temp table and manipulate the data* in it.
I
want to update the backend with this new data but my UPDATE *query
fails
as my temp table is local and the SQL database doesn't know *about it.

There are no linked tables in the FE database.


I have the following (DAO):


Set Db = CurrentDb
Set Qdf = Db.CreateQueryDef(TMP_QUERY_NAME)


Qdf.connect = ConnectString()


sqlString = "UPDATE tblRemote " & _
"SET " & _
"tblRemote.Some_Foo = tblLocal.Foo, " & _
"FROM tblRemote INNER JOIN tblLocal " & _
"ON tblRemote.Some_ID = tblLocal.Some_ID;"


Qdf.sql = sqlString
Qdf.ReturnsRecords = False
Qdf.Execute dbFailOnError


Is there any way of doing this without adding a linked table*?
Thanks,


chris

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 06:52 AM
dbmonitor
 
Posts: n/a
Default Re: Update remote table from local table

When you say there are no linked tables in the FE, how are you
transfering the data from the back end to the front? After all,
wouldn't tblRemote have to be a link table itself? You are connecting
to the current access database to update the rows and if this table is
not a link table then you cannot update it on the sql server.

If you do not want a link table then you will need to create a new
connection to the SQL Server, retrieve the information from tblLocal
into a recordset and build and execute an update on the SQL Server for
each record in your set.

--
David Rowland
MS SQL Server DBMonitor author
http://dbmonitor.tripod.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 06:52 AM
chris ciotti
 
Posts: n/a
Default Re: Update remote table from local table

On Sun, 30 Jan 2005 19:57:08 -0500, dbmonitor wrote
(in article <1107133028.393670.206590@z14g2000cwz.googlegroups .com>):

> When you say there are no linked tables in the FE, how are you
> transfering the data from the back end to the front? After all,
> wouldn't tblRemote have to be a link table itself? You are connecting
> to the current access database to update the rows and if this table is
> not a link table then you cannot update it on the sql server.
>


Hi -

Thanks for the reply. I'm not using linked tables, I only connect (via code)
when necessary via the .Connect property of the Querydef object.

> If you do not want a link table then you will need to create a new
> connection to the SQL Server, retrieve the information from tblLocal
> into a recordset and build and execute an update on the SQL Server for
> each record in your set.


I'll give this a try, might you have some example code? It can be in any
language. Thanks.

--chris

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:26 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com