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

Update multiple rows

Status
Not open for further replies.

robbie123

IS-IT--Management
Aug 18, 2004
1
CA
I have been struggling with (what I thought would be a simple Update query).

I have a number of info systems running on many different platforms I am trying to sync user info on them. I had written a simple script to create the SQL query to update the SQL DB's.
I assumed that something similar to (below) would work:
This works fine for one row, but as soon as I add a 2nd set/where statement I get a syntax error on "=":

Update mydatabase
Set location= 'nowhere', address = '123 nowhere st'
where employee_id = '12345'
Set location= 'somewhere', address = '123 somewhere ave'
where employee_id = '67890'

I would like to just be able to run the script every month and past a huge Update query into Interdev. Am I missing something stupid with the syntax or is there something fundimentally wrong with this logic???
 
You have two statements, thats all.
Code:
Update myTable Set
    location= 'nowhere',
    address = '123 nowhere st'
where employee_id = '12345'

Update myTable Set
    location= 'somewhere',
    address = '123 somewhere ave'
where employee_id = '67890'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top