troubleshooting Question

Sql Server Inline table Valued Function

Avatar of jeremyj54
jeremyj54 asked on
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008
12 Comments1 Solution704 ViewsLast Modified:
Is there any way to change this scalar function into an inline table valued function?

GO
/****** Object:  UserDefinedFunction [dbo].[RECEIVER_TRACE_ID]    Script Date: 02/11/2012 16:51:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:            
-- Create date: 2012-02-07
-- Description:      Reciept TRACE_ID
-- =============================================
ALTER FUNCTION [dbo].[RECEIVER_TRACE_ID]
(
      @PURCHASE_ORDER VARCHAR(30),@PURCHASE_LINE VARCHAR(10)
)
RETURNS VARCHAR(8000)
AS
BEGIN
      DECLARE @trace_list VARCHAR(8000)

      SELECT @trace_list =
      COALESCE(@trace_list + ', ', '') + LTRIM(TRACE_ID)
FROM         INVENTORY_TRANS INNER JOIN
                      TRACE_INV_TRANS ON INVENTORY_TRANS.TRANSACTION_ID = TRACE_INV_TRANS.TRANSACTION_ID
WHERE     (INVENTORY_TRANS.TYPE = 'I') AND (INVENTORY_TRANS.CLASS = 'R') AND (INVENTORY_TRANS.PURC_ORDER_ID = @PURCHASE_ORDER and INVENTORY_TRANS.PURC_ORDER_LINE_NO = @PURCHASE_LINE)

      
      RETURN @trace_list

END
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros