Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help with SQL Query Please :)

Author  Topic 

schemjo
Starting Member

2 Posts

Posted - 2009-12-18 : 13:51:21
I'm having issues with this SQL query and would like some assistance. When I run this I get 'Syntax error in UPDATE statement'. If it matters at all, I'm running this from an Access database and trying to update a SQL table on a remote server.

I wouldn't even consider myself a newbie but I'm trying to get by. Any assistance would be greatly appreciated!


Update [dbo_JOEtblWebLookup-Roles]
SET [dbo_JOEtblWebLookup-Roles].RoleID = temp.RoleId, [dbo_JOEtblWebLookup-Roles].RoleName =temp.RoleName,

FROM

(SELECT [dbo_table].[RLRLCD] as RoleID, [dbo_table].RLRPDS as RoleName,
FROM
[dbo_table]) as Temp;

Joe
--
http://my-new-sunglasses.com

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-18 : 14:02:02
Well you do have extra commas in there, but you seem to be missing the join conditions. How will it know which rows in Temp are associated with your JOE table?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

schemjo
Starting Member

2 Posts

Posted - 2009-12-19 : 18:11:53
Thanks for the direction. I'll look up JOIN and see if I can correct the issue. :)

Joe
--
http://my-new-sunglasses.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-12-20 : 03:07:01
also if you're executing it from access have you set up a linked server connection to sql server?
Go to Top of Page
   

- Advertisement -