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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help with this query syntax

Author  Topic 

SHIVPREET2K1
Starting Member

32 Posts

Posted - 2009-04-18 : 02:07:13
Dear all


Please tell me whats the problem with following query . its giving me an error.

UPDATE Buyer_Dispatches INNER JOIN proformainvoiceforcustom
ON Buyer_Dispatches.pi_No = proformainvoiceforcustom.PiNo
SET Buyer_Dispatches.Buyer_Code = proformainvoiceforcustom.BuyerCode
WHERE (((Buyer_Dispatches.Buyer_Code) Is Null));

The error is:

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'INNER'.
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'Buyer_Dispatches'.



I am not able to understand why this error is coming.

Please help its urgent.

Tks

Shiv Preet

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-04-18 : 02:13:17
UPDATE b
SET b.Buyer_Code = p.BuyerCode
from
Buyer_Dispatches b INNER JOIN proformainvoiceforcustom p
ON Buyer_Dispatches.pi_No = proformainvoiceforcustom.PiNo
WHERE b.Buyer_Code Is Null

Go to Top of Page

SHIVPREET2K1
Starting Member

32 Posts

Posted - 2009-04-18 : 02:20:24
yes friend thanks for the help. but this query was working fine in msaccess. I m confused why it behave like that in sql server
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-04-18 : 02:26:26
Welcome

syntax:In sql update tablename
set values(columnsname) = newvalues(assgining values)
where condition(if requires)

further details see booksonline for syntax of insert,update,delete statements
Go to Top of Page
   

- Advertisement -