USE [DD_ECM]
GO

/****** Object:  UserDefinedFunction [dbo].[FNCUST_GET_NAVISION_VENDOR_INFO]    Script Date: 21.03.2024 17:17:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



-- T-SQL Tabellenwertfunktion zu Ausgabe des Kreditor Namen
--14.07.2023	MS	Update BC ID
-- Stand: MK // 15.09.2021

CREATE FUNCTION [dbo].[FNCUST_GET_NAVISION_VENDOR_INFO] (	
		@Mandant		VARCHAR(8),		-- Default VHM
		@VendorNr		VARCHAR(25)
)
RETURNS TABLE  
AS  
RETURN

	-- Daten aus dem FiBu Modul
	SELECT TOP 1 LTRIM(RTRIM([Name]))					as 'Lieferanten-Name',
				 LTRIM(RTRIM([Our Account No_]))		as 'KundenNr-Lieferant'

	FROM		[NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[STW Bebra GmbH inkl Netz$Vendor$437dbf0e-84ff-417a-965d-ed2bb9650972]
	
	WHERE LTRIM(RTRIM([No_]))	= LTRIM(RTRIM(@VendorNr))

GO


