I am trying to send SMS messages to phone numbers in MobileConnect. I need to add a "1" in front of the existing mobile numbers that I have in a Data Extension, to adhere to the proper syntax MobileConnect requires.

Can I add a statement to my SQL query Automation Activity that populates the DE being used to import contacts into Mobile Connect?


You sure can! Using the sql function CAST to first turn the numbers into VarChar, then you combine them together (via +) and then as the field type is number it will automatically put it back into a number format.

See below for a sample:

SELECT CAST('1' AS VARCHAR(1)) + CAST(mobileNumber AS VARCHAR(10)) as mobileNumber
  • Is this the Query That I would write? SELECT FirstName, LastName, Email, Phone, FROM Lead_Salesforce SELECT CAST('1' AS VARCHAR(1)) + CAST(Phone AS VARCHAR(10)) as Mobile Number FROM Lead_Salesforce
    – D. Dean
    Oct 1 '18 at 14:30
  • I don't believe so. It is hard to read from comments, but I think that is malformed with 2 SELECT statements. Try something like: SELECT CAST('1' AS VARCHAR(1)) + CAST(Phone AS VARCHAR(10)) as [Mobile Number], FirstName, LastName, Email FROM Lead_Salesforce Oct 1 '18 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.