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 Administration
 sql server to sybase

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2012-10-24 : 06:58:41
hi i have this query

UPDATE ACRT
SET Yourcolumn = CASE
WHEN ACRT.NEGWATCH = 1 THEN x.IRBRATING
ELSE IRBT.IRBRATING END
FROM ACRT
INNER JOIN IRBT
ON IRBT.MOODYSRATE = ACRT.MOODYSRATE
CROSS APPLY (
SELECT i.IRBRATING
FROM IRBT i
WHERE i.ID = IRBT.ID +1
) x


it works the way i want it on sql server buti get error when i run it in sybase
errors are

[DATADIRECT][ODBC SYBASE WIRE PROTOCOL DRIVER][SQL SERVER]INCORRECT SYNTAX NEAR 'CROSS'.
[DATADIRECT][ODBC SYBASE WIRE PROTOCOL DRIVER][SQL SERVER]INCORRECT SYNTAX NEAR 'X'.

does anyone now how i can get this working

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-24 : 07:03:02
I don't have sybase, and don't know much about it, but I suspect it is the cross apply that is causing the problem. If so you can try this:
UPDATE ACRT 
SET Yourcolumn = CASE
WHEN ACRT.NEGWATCH = 1 THEN x.IRBRATING
ELSE r.IRBRATING END
FROM ACRT
INNER JOIN IRBT r
ON r.MOODYSRATE = ACRT.MOODYSRATE
INNER JOIN IRBT x
ON x.ID = r.ID +1
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2012-10-24 : 07:06:41
think that did the job
thanks
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-24 : 07:35:18
You are welcome!
Go to Top of Page
   

- Advertisement -