473,472 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Rewritten UPDATE query - is it the same?

My client has moved their back-end database from Access to SQL Server,
and now the following query doesn't work (Operation must use an
updateable query):

UPDATE tblbookings INNER JOIN tblREFUNDS ON tblbookings.TransFromID =
tblREFUNDS.BookingID SET tblREFUNDS.[MOVED TO NEW BKREF] =
tblbookings.bookingid
WHERE (((tblREFUNDS.[MOVED TO NEW BKREF])=0) AND
((tblbookings.TransFromID) Is Not Null));

Both the following variations seem to work, but I can't decide if they
are syntactically interchangeable:

UPDATE tblRefunds, tblBookings
SET [MOVED TO NEW BKREF] = tblbookings.bookingid
WHERE (((tblREFUNDS.[MOVED TO NEW BKREF])=0) AND
((tblbookings.TransFromID) Is Not Null)) AND (tblREFUNDS.BookingID =
tblbookings.bookingid);

UPDATE tblREFUNDS AS R SET R.[MOVED TO NEW BKREF] = (SELECT
tblbookings.bookingid from tblbookings where
tblbookings.TransFromID = R.BookingID AND tblbookings.TransFromID IS
Not Null)
WHERE (((R.[MOVED TO NEW BKREF])=0));

I can't really test this because it's live data, and time is
incredibly tight, so you have my copious thanks in advance.

Edward
Jun 27 '08 #1
2 938
On Tue, 29 Apr 2008 03:25:51 -0700 (PDT), te********@hotmail.com
wrote:

Backup the database (or take the backup from last night). Restore it
as <dbname>_Beta and perform your tests there. You can spare the 5
minutes.
My gut feeling: both are interchangeable.

-Tom.

>My client has moved their back-end database from Access to SQL Server,
and now the following query doesn't work (Operation must use an
updateable query):

UPDATE tblbookings INNER JOIN tblREFUNDS ON tblbookings.TransFromID =
tblREFUNDS.BookingID SET tblREFUNDS.[MOVED TO NEW BKREF] =
tblbookings.bookingid
WHERE (((tblREFUNDS.[MOVED TO NEW BKREF])=0) AND
((tblbookings.TransFromID) Is Not Null));

Both the following variations seem to work, but I can't decide if they
are syntactically interchangeable:

UPDATE tblRefunds, tblBookings
SET [MOVED TO NEW BKREF] = tblbookings.bookingid
WHERE (((tblREFUNDS.[MOVED TO NEW BKREF])=0) AND
((tblbookings.TransFromID) Is Not Null)) AND (tblREFUNDS.BookingID =
tblbookings.bookingid);

UPDATE tblREFUNDS AS R SET R.[MOVED TO NEW BKREF] = (SELECT
tblbookings.bookingid from tblbookings where
tblbookings.TransFromID = R.BookingID AND tblbookings.TransFromID IS
Not Null)
WHERE (((R.[MOVED TO NEW BKREF])=0));

I can't really test this because it's live data, and time is
incredibly tight, so you have my copious thanks in advance.

Edward
Jun 27 '08 #2
On 29 Apr, 15:42, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On Tue, 29 Apr 2008 03:25:51 -0700 (PDT), teddysn...@hotmail.com
wrote:

Backup the database (or take the backup from last night). Restore it
as <dbname>_Beta and perform your tests there. You can spare the 5
minutes.
My gut feeling: both are interchangeable.

-Tom.
Thanks. Will do.

Edward

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
2
by: ford_desperado | last post by:
I take it the optimizer rewrites my queries. Can i see the rewritten ones? DB2 UDB v8.1 TIA
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
11
by: ZafT | last post by:
Hi all - thanks in advance for any help. I am trying to write a simple update script. In fact, I am re-using code that I've used before (successfully) but I can't figure out why it is not...
3
by: eholz1 | last post by:
Hello PHP programmers. I had a brilliant idea on one of my pages that selects some data from my mysql database. I first set the page up to display some info and an image, just one item, with a...
3
by: webmasterATflymagnetic.com | last post by:
Folks, I'm struggling to put the question together, but I have this problem. I have written an HTML form that I can use for data entry. This uses PHP to write a SQL UPDATE command that gets...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.