MailAddress C# Class replication in Snowflake

49 views Asked by At

Migrating a stored procedure from SQL Server to Snowflake wherein on SQL Server side MailAddress C# function is being used to derive the Address from the EmailAddress column in the table. And also this is being used to check if the email is valid.

Essentially passing the column value to the MailAddress initialization command and within TRY/CATCH checking if its valid.

try
{
    MailAddress ma = new MailAddress(EmailAddress.ToString());
    Address = ma.Address;
    valid = true;
}
catch (Exception)
{
    Address = null;
    valid = false;
}

When rewriting the procedure for Snowflake, obviously we don't have the same function in Snowflake. I understand we can create an external function now in C# but it will be a costly affair.

What I want to understand is since the base problem solved by the MailAddress class is to format the email address and check if it is following a set pattern. This is something can be done via REGEX in Snowflake.

Do we know what format checks MailAddress class perform on the value to try to replicate the same in Snowflake?

0

There are 0 answers