none
CROSS APPLY Equivalent

    Question

  •  

    I have a question, is there any equivalent for the CROSS APPLY operator in SQL server 2000?

     

    I have the following code in SQL Server 2005 and it works fine, but I need an equivalent code in SQL server 2000.

     

     

    SELECT *

    FROM Customers Cust CROSS APPLY dbo.GetAccountAttributes(Cust.AccountNo) Att

     

     

    what I need is to join a function and passing it a dynamic parameter.

     

    I need it urgently

     

     

    Thanks in advance,

    Imad Elayyan

    Tuesday, April 29, 2008 12:15 PM

Answers

  • No, there is not an equivalent in SS 2000. You can not pass a column from the other tables, involved in the join, to the table-valued udf.

     

     

    AMB

     

    Tuesday, April 29, 2008 5:16 PM
    Moderator

All replies

  • Can you provide the code from GetAccountAttributes?

    Tuesday, April 29, 2008 12:41 PM
    Moderator
  • The GetAccountAttributes function get the information from linked server and I can't remove the function and write the queries in the stored procedure because I need the access to the linked server is centralized in just one location

     

    Function GetAccountAttributes(@AccountNo varchar(50))

     

    Returns table

    as

     

    SELEct *

    FROM lnk..Alias.Table

    WHERE X = @AccountNo

     

     

     

    Tuesday, April 29, 2008 1:56 PM
  • Remove the function  and use a join, u may also make use of a CTE and then join to base query to keep it simple.

     

    Tuesday, April 29, 2008 3:40 PM
  • No, there is not an equivalent in SS 2000. You can not pass a column from the other tables, involved in the join, to the table-valued udf.

     

     

    AMB

     

    Tuesday, April 29, 2008 5:16 PM
    Moderator
  •  Nitin Khurana wrote:
    Remove the function  and use a join, u may also make use of a CTE and then join to base query to keep it simple.

     

     

    CTE's are not available in SQL 2000.  If the code to the function could be posted, a viable derived join could be created that allows this to function in 2000.

    Tuesday, April 29, 2008 5:49 PM
    Moderator