Knowledge of SQL Server Management Studio is needed to create the function below in the database, please contact support@rentp.com for assistance if needed
Execute the function below in SQL Server Management Studio using your database name
USE [RentalPoint] /* change this to your RentalPoint DataBase name*/
go
/****** Object: UserDefinedFunction [dbo].[GetCustNotes] Script Date: 2020-04-03 10:38:52 AM ******/
SET ansi_nulls ON
go
SET quoted_identifier ON
go
CREATE FUNCTION [dbo].[Getcustnotes] (@CustCode VARCHAR(30))
returns VARCHAR(300)
AS
BEGIN
DECLARE @notes VARCHAR(max);
SET @notes = '';
SELECT @notes = @notes + ' '
+ Cast(COALESCE(text_line, '') AS VARCHAR(max))
FROM tblcustnote
WHERE customer_code = @CustCode
RETURN( @notes );
END
Then Paste the query below into Excel Query Builder
SELECT C.organisationv6 AS [COMPANY NAME],
Isnull(dbo.Getcustnotes(c.customer_code), '') AS [NOTES]
FROM tblcust c
WHERE Isnull(c.customer_code, ' ') <> ''
AND c.disabledcust = 'N'
ORDER BY c.organisationv6