Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update

Status
Not open for further replies.

alh1002

Technical User
Mar 27, 2006
41
US
I have queries are the basis to update tables. When updating tables I want to insert values but not to overwrite any existing data. How can I make sure I update something while checking if anything is there already. And if so, it can't be written.

example
Table
ladder_date/NAV
1-21-05/2154

If my query yields a new value I do not want that particular value inserted.

the following was my first guess but it doesn't work because I am statement deletes everything in the table I am trying to update but it gives you the idea of what I want. (and it is asking asking for a parameter) so I can't use the where statment

SELECT dS.ladder_date, dS.BOM, dS.NAV, dS.gTDRT, dS.gTDCHANGEPER INTO tblDailyPerformance
FROM DailySummary AS dS
WHERE (((tblDailyPerformance.ladder_date) Is Null));

 
Make a backup copy of the tables you wish to update. Updates are irreversible. Then create a Select query and make sure it returns the needed records. Next go to the overhead toolbar (Query > UpDate Query)and convert the Select statement to an Update query. Set the new values you wish to update to.

The SQL statement you indicated is just going to return records, it will not delete or update any. Following is an example of an Update statement. Note that it will only update the designated Nulls. It will not alter fields with zero length strings

UPDATE Table SET Table.Field1 = "whatever value"
WHERE ((Table.Field1)Is Null));

Cheers,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top