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

Updating a DATE_TIME field

Status
Not open for further replies.

DJandLO

Technical User
Jun 16, 2011
6
US
I need to update the Confirmation_Date_Time field to NULL for a specific meeting but am unsure how to insert it.

Meet_Master.MEETING is where the meeting code AM2011 is.

The script below works for an individual but if they have more than 1 confirmation date it clears then all.

UPDATE ORDERS
SET CONFIRMATION_DATE_TIME = NULL
WHERE ORDERS.ST_ID = '236477'

Thanks!
 
how are the Meet_Master and ORDERS tables linked?

Sounds like you want to update a table based on a join with another table.

Something like this.

Code:
UPDATE ORDERS 
SET CONFIRMATION_DATE_TIME = NULL
FROM ORDERS
     INNER JOIN Meet_Master
        On ORDERS.CommonColumn = Meet_Master.CommonColumn
WHERE ORDERS.ST_ID = '236477'
      And Meet_Master.MEETING = 'AM2011'

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
After a couple of trys in my dev environment & an adjustment it worked!

UPDATE Orders
SET Orders.CONFIRMATION_DATE_TIME = NULL
FROM Orders
INNER JOIN Meet_Master
On Orders.STATUS = Meet_Master.STATUS
WHERE Meet_Master.MEETING = 'AM2011'

Thanks!

DJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top