QuestionQ22

Design and develop database solutions

You have a SQL database in Microsoft Fabric that includes a column named Payload. Payload stores customer data in JSON documents in the following format.

Question Image

Data analysis indicates that some customers use subaddressing in their email addresses, for example, user+tag@contoso.com.

You need to return a normalized email value that removes the subaddressing; for example, user1+tag@contoso.com must be normalized to user1@contoso.com.

Which Transact-SQL expression should you use?

Explanation

REGEXP_REPLACE replaces text that matches a regular-expression pattern. The pattern \+.*@ matches the plus sign, the subaddressing text, and the following at sign. Replacing that match with @ preserves the original local part and domain while removing the subaddressing.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!