Forum Discussion

jpersQ's avatar
jpersQ
Frequent Visitor
1 year ago
Solved

SQL REPLACE function broken on Fabric Lakehouse SQL Endpoint

REPLACE is not replacing values in some instances:

 

 

  • Hi jpersQ
     To remove all carriage return (CHAR(13)) and line feed (CHAR(10)) characters from your SQL Server data, you can utilize the REPLACE function as follows:

    SELECT [Id],
           [Description],
           REPLACE(
               REPLACE(
                   REPLACE(Description, CHAR(13) + CHAR(10), ''),
                   CHAR(13), ''),                                
               CHAR(10), '') AS Cleaned_Description              
    FROM bronze_Salesforce_event;



     

    Best regards,
    Ray Minds
    http://www.rayminds.com
    https://www.linkedin.com/company/rayminds/

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



11 Replies

    • jpersQ's avatar
      jpersQ
      Frequent Visitor

      The query is as above: 

      SELECT ASCII(SUBSTRING(REPLACE(REPLACE(CAST([Description] AS NVARCHAR(4000)), NCHAR(13), ''), NCHAR(10), ''), 14, 1)) AS D
      FROM [dbo].[bronze_Salesforce__event]
      where Id= '00UVS000003zCXI2A2'

      I'm having a hard time getting an anyonymized data example since the issue is finicky.

       

      • nilendraFabric's avatar
        nilendraFabric
        Super User

        SELECT ASCII(SUBSTRING(REPLACE(REPLACE(CAST([Description] AS VARCHAR(8000)), CHAR(13), ''), CHAR(10), ''), 14, 1)) AS D
        FROM [dbo].[bronze_Salesforce__event]
        WHERE Id = '00UVS000003zCXI2A2'

         

         

        try this once 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jpersQ,

    Thanks for reaching out to the Microsoft fabric community forum.

     

    It looks like you are facing issue with REPLACE function, which is not working properly in few instances. As nilendraFabric responded to your query, were you abke to go through his responses. If you are able to solve the issue, please mark the helpful reply as solution.

     

    I would also take a moment to thank nilendraFabric, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

     

    If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

    Best Regards,
    Hammad.
    Community Support Team

     

    If this post helps then please mark it as a solution, so that other members find it more quickly.

    Thank you.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi jpersQ,

      May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

       

      Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jpersQ,

    As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.

    If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.


    If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
    Thank you for your patience and look forward to hearing from you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jpersQ,

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so that other community members can find it easily.


    Thank you.

  • Ray_Minds's avatar
    Ray_Minds
    Solution Supplier

    Hi jpersQ
     To remove all carriage return (CHAR(13)) and line feed (CHAR(10)) characters from your SQL Server data, you can utilize the REPLACE function as follows:

    SELECT [Id],
           [Description],
           REPLACE(
               REPLACE(
                   REPLACE(Description, CHAR(13) + CHAR(10), ''),
                   CHAR(13), ''),                                
               CHAR(10), '') AS Cleaned_Description              
    FROM bronze_Salesforce_event;



     

    Best regards,
    Ray Minds
    http://www.rayminds.com
    https://www.linkedin.com/company/rayminds/

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.