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)
 Cross apply problem

Author  Topic 

abhwhiz
Starting Member

37 Posts

Posted - 2007-07-31 : 11:13:16
Hi all,

Please guide me, I am not able to figure out what the error is ...

the query is given below..

SELECT StoreName=s.Name, [Top].ShipDate,
[Top].SalesOrderID, TotalDue='$'+[Top].TotalDue
FROM AdventureWorks.Sales.Store AS s
JOIN AdventureWorks.Sales.Customer AS c
ON s.CustomerID = c.CustomerID
CROSS APPLY
AdventureWorks.Sales.fnTopNOrders(c.CustomerID, 5) AS [Top]
WHERE CustomerType='S'
ORDER BY StoreName, convert(money,TotalDue) DESC

all i get is an error:-

Msg 102, Level 15, State 1, Line 7
Incorrect syntax near '.'.

is this is a "service pack" problem? i am not able to figure out, i tried other examples given in net/books as well, but i am getting the same error.. :(

Thanks in advance..

senpoly
Starting Member

19 Posts

Posted - 2007-07-31 : 11:19:06
this is compatibility problem, as cross apply will work only on 90 compatibility, where as
your database may be set as 80 or below

regards
senthil
Go to Top of Page

kapilarya
Yak Posting Veteran

86 Posts

Posted - 2007-07-31 : 11:23:14
Put some test table and test data to evalute the problem

Kapil Arya
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-01 : 02:16:47
As said check for the compatibility. Also it seems you are trying to format the money value which should be done in front end application if the data are shown there

Madhivanan

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

abhwhiz
Starting Member

37 Posts

Posted - 2007-08-01 : 05:08:14
:senthil

yup, u were right, it was a compatibility issue, it worked fine when i changed the comaptibility

:madhi

point taken!

thanks a lot..
Go to Top of Page
   

- Advertisement -