Very useful SQL Scripts related queries, topics and discussions
User avatar
By admin
#354 The below SQL Function will help you to trim out strange white characters, etc. from a Scala field.
It is very useful in case of you are going to upgrade from iScala 2.2 SR2 to v.3.0 as well as installing a newer HotFix.

It seems Epicor made the latest HotFix 3.00.2380 very sensitive on that, especially when printing out an invoice.
In a most recent case iScala invoked an error while complaining about DDF Field <420> Customer VAT Number.
So the field needed to be trimmed in order to fix this issue by executing the funtion below :o

UPDATE SL01cc00 SET SL01021 = dbo.Trim(SL01021)

Code: Select allSET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[Trim] (
       @Str nvarchar(max)
)
RETURNS nvarchar(max) AS
BEGIN
       DECLARE @Result nvarchar(max)

       SET @Result = LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
              LTRIM(RTRIM(@Str)), CHAR(9), ''), CHAR(10), ''), CHAR(11), ''), CHAR(12), ''), CHAR(13), '')))

       RETURN @Result
END
Attachments
sqltrimissue.png
Error during printing Invoice from iScala 3.0