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 2000 Forums
 Transact-SQL (2000)
 New to SQL scripts.. what's wrong here?

Author  Topic 

DHall
Starting Member

1 Post

Posted - 2006-04-13 : 14:59:27
New to SQL scripts.. what's wrong here? -besides that I don't know what I am doing?

UPDATE TESTF.DBO.PURCHASE_ORDER_LINE.DESIRED_RECEIVE_DATE IN

(SELECT TEST.DBO.CUST_ORDER_LINE.DESIRED_SHIP_DATE
FROM
TEST.DBO.CUST_ORDER_LINE, TEST.DBO.CUSTOMER_ORDER
WHERE
TEST.DBO.CUSTOMER_ORDER.ID = TEST.DBO.CUST_ORDER_LINE.CUST_ORDER_ID AND
TEST.DBO.CUSTOMER_ORDER.CUSTOMER_ID='FTC' AND
TEST.DBO.CUSTOMER_ORDER.STATUS='R')

WHERE
TESTF.DBO.PURC_ORDER_LINE.PURC_ORDER_ID = TESTF.DBO.PURCHASE_ORDER.ID
TESTF.DBO.PURCHASE_ORDER.VENDOR_ID='L&E' AND
TESTF.DBO.PURCHASE_ORDER.STATUS='R' AND
TESTF.DBO.PURC_ORDER_LINE.TOTAL_RECEIVED_QTY < TESTF.DBO.PURC_ORDER_LINE.ORDER_QTY AND
TESTF.DBO.PURC_ORDER_LINE.PURC_ORDER_ID = TEST.DBO.CUSTOMER_ORDER.CUSTOMER_PO_REF AND
TESTF.DBO.PURC_ORDER_LINE.LINE_NO = TEST.DBO.CUST_ORDER_LINE.LINE_NO

Error messages..
Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'IN'.
Server: Msg 156, Level 15, State 1, Line 12
Incorrect syntax near the keyword 'WHERE'.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-13 : 18:57:57
Are you trying to update the table with some value ?
the syntax should be

update tablename
set col1 = something,
col2 = something
where somecondition




KH


Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-04-13 : 22:53:49
i believe you need something like this, you're missing the actual update (set)

quote:
from bol
UPDATE titles
SET price = price * 2
WHERE pub_id IN
(SELECT pub_id
FROM publishers
WHERE pub_name = 'New Moon Books')



--------------------
keeping it simple...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-14 : 07:53:36
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -