WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ODBC
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Keywords: 	 Access SQL Update

Access SQL Update

Creates an update query that changes values in fields in a specified table based on specified criteria.

Syntax...


UPDATE table
SET newvalue
WHERE criteria;

The UPDATE statement has these parts:

Part		Description
----		-----------
table		The name of the table containing the data 
		you want to modify.
newvalue	An expression that determines the value to be 
		inserted into a particular field in the updated 
		records.
criteria	An expression that determines which records 
		will be updated. Only records that satisfy 
		the expression are updated.
Remarks.....

UPDATE is especially useful when you want to change many records or when the records that you want to change are in multiple tables. You can change several fields at the same time. The following example increases the Order Amount values by 10 percent and the Freight values by 3 percent for shippers in the United Kingdom:


UPDATE Orders
SET OrderAmount = OrderAmount * 1.1,
Freight = Freight * 1.03
WHERE ShipCountry = 'UK';

Important...

WinBatch code....


retcode = qExecDirect(hstmt, "UPDATE Orders SET OrderAmount = OrderAmount * 1.1, Freight = Freight * 1.03 WHERE ShipCountry = 'UK'")

If (retcode != @qSuccess) && (retcode != @qSuccessInfo)
  ret=qError(hstmt,2)
  Message("MS ACCESS Error", ret)
  Exit
Endif




Article ID:   W14184
Filename:   Access SQL Update.txt
File Created: 2001:01:25:13:54:40
Last Updated: 2001:01:25:13:54:40