What is cast and convert in SFMC

eg- SELECT Count(*) as Count, CAST(GETUTCDATE() as date) AS Day, GETUTCDATE() AS [Updated Date] FROM ENT.[Demo4 Contact__IQ] WHERE [Status Code] = 'Active'

1 Answer 1


CAST & CONVERT are SQL conversion functions in SFMC. Both can be used to convert an input expression into specific data type, but CONVERT additionally provides formatting capability. Syntax is as follows:

CAST ( expression AS data_type [ ( length ) ] )
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

The valid input values for style can be found in the official SQL reference mentioned at the end of this answer.

Salesforce Marketing Cloud user MS SQL server database and its syntax is T-SQL (refer here).

SQL support for the SQL Query Activity is based on, but doesn’t precisely correspond to, SQL Server 2016 capabilities. (refer here)

For detailed information on CAST & CONVERT, check this out. Note that not all of the information given in the reference link might hold true with reference to Mktg Cloud, but most of it should.

Not the answer you're looking for? Browse other questions tagged .