0
When trying to format the data of the CEP variable, SQL Server returns the following message:
Argument data type varchar is invalid for argument 1 of format Function.
Just follow my code:
DECLARE @cep VARCHAR(9) = '23574510';
SELECT FORMAT(@cep,'#####-###') AS [CEP]
Where am I going wrong?
the function
FORMAT
accepts only numbers and dates as parameter: https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql?view=sql-server-ver15– Ricardo Pontual
Thank you Ricardo!
– Kelly Soares