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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to update a record

Status
Not open for further replies.

ccampbell

Programmer
Joined
Aug 16, 2001
Messages
201
Location
US
I am writing code that inserts a new record into a database, Later on in the code I want to be able to pull up that record and update some of the fields in that record. I am not sure how to get started doing this. Does anyone have an example? Here is what I have come up with

UPDATE tablename
SET fieldname = 'somevalue'
SET fieldname2 = 'somevalue2'
.
.
.

How do I pull up the correct record to update though. Can I throw a where clause in the update statement like

UPDATE tablename
SET fieldname = 'somevalue'
SET fieldname2 = 'somevalue2'
.
.
.
WHERE idnumber = '12345'(primary key of the record)
Any help is certainly appreciated. Thanks in advance

 
Yes .. you'r correct. Use the where statement. Ashley L Rickards
SQL DBA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top