Which SQL expression removes both carriage return and line feed characters from a string?

Prepare for the Marketing Cloud Developers Certification Exam. Dive into multiple-choice questions with detailed explanations and hints. Enhance your skills and ensure success with targeted prep.

Multiple Choice

Which SQL expression removes both carriage return and line feed characters from a string?

Explanation:
Removing control characters from a string is addressed by replacing those specific characters with nothing. Carriage return and line feed are represented as CHAR(13) and CHAR(10) respectively. The expression does this in two steps: it first eliminates carriage returns, then removes line feeds, resulting in a string with both characters removed wherever they appear. This approach directly targets the characters you want to drop, so internal CR/LF sequences are cleaned out, not just at the ends. The other options don’t achieve that: concatenation would add characters, TRIM removes only leading and trailing whitespace in most cases, and reversing would just flip the string. If available, a function like TRANSLATE can drop multiple characters in one call, but the nested REPLACE approach is a clear and portable way to remove both CR and LF.

Removing control characters from a string is addressed by replacing those specific characters with nothing. Carriage return and line feed are represented as CHAR(13) and CHAR(10) respectively. The expression does this in two steps: it first eliminates carriage returns, then removes line feeds, resulting in a string with both characters removed wherever they appear. This approach directly targets the characters you want to drop, so internal CR/LF sequences are cleaned out, not just at the ends. The other options don’t achieve that: concatenation would add characters, TRIM removes only leading and trailing whitespace in most cases, and reversing would just flip the string. If available, a function like TRANSLATE can drop multiple characters in one call, but the nested REPLACE approach is a clear and portable way to remove both CR and LF.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy