Reputation: 9080
This SQL:
select FORMAT(lNum,'##-###-##-###')
from [rpt].[myView]
Produces the following error:
Argument data type varchar is invalid for argument 1 of format function.
lNum
is a varchar(10)
Running SQL Server 2012
Upvotes: 9
Views: 56105
Reputation: 49260
varchar
isn't supported as the first argument to FORMAT
. The only categories of datatypes supported are Date and Time
and Numeric
.
You could do
select FORMAT(cast(lNum as numeric),'##-###-##-###') from [rpt].[myView]
From levelonehuman's comment : Documentation
Upvotes: 19