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

SQL Query not working 1

Status
Not open for further replies.

phil22046

Programmer
Sep 12, 2001
154
US
I have an update query I need to run one time:

UPDATE memaddr
SET {memaddr.Address1 = Temp_NonDPV_Batch.Address1,
memaddr.Address2 = Temp_NonDPV_Batch.Address2,
memaddr.city = Temp_NonDPV_Batch.city,
memaddr.state = TEMP_NonDPV_Batch.state,
memaddr.zip = Temp_NonDPV_Batch.zip }
from Temp_NONDPV_Batch
INNER JOIN memaddr
ON memaddr.memid = Temp_NonDPV_Batch.Memid
WHERE memaddr.preferred in (-1,1)

I get this error message in query analyzer and don't know what I am doing wrong.

[Microsoft][ODBC SQL Server Driver]Syntax error or access violation

Can somebody explain this so I can get unstuck please?
 
no brackets

Code:
UPDATE memaddr 
   SET memaddr.Address1 = Temp_NonDPV_Batch.Address1, 
        memaddr.Address2 = Temp_NonDPV_Batch.Address2,
        memaddr.city = Temp_NonDPV_Batch.city,
        memaddr.state = TEMP_NonDPV_Batch.state,
        memaddr.zip = Temp_NonDPV_Batch.zip 
   from Temp_NONDPV_Batch
  INNER JOIN memaddr
     ON memaddr.memid = Temp_NonDPV_Batch.Memid 
WHERE memaddr.preferred in (-1,1)

Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top